[英]Rebuilding docker image is failing although using the same Dockerfile as shown in the hub
I would like to build this docker image by myself: chrisgeorge/nightmare-headless ( https://hub.docker.com/r/chrisgeorge/nightmare-headless/~/dockerfile/ ) 我想自己构建一个docker镜像:chrisgeorge / nightmare-headless( https://hub.docker.com/r/chrisgeorge/nightmare-headless/~/dockerfile/ )
So I used the same Dockerfile. 所以我使用了相同的Dockerfile。
Dockerfile Docker文件
FROM node:slim
RUN apt-get update && \
apt-get install -y \
xvfb \
x11-xkb-utils \
xfonts-100dpi \
xfonts-75dpi \
xfonts-scalable \
xfonts-cyrillic \
x11-apps \
clang \
libdbus-1-dev \
libgtk2.0-dev \
libnotify-dev \
libgnome-keyring-dev \
libgconf2-dev \
libasound2-dev \
libcap-dev \
libcups2-dev \
libxtst-dev \
libxss1 \
libnss3-dev \
gcc-multilib \
g++-multilib \
xauth \
git \
sudo \
--no-install-recommends \
&& apt-get autoclean \
&& apt-get clean \
&& rm -rf /var/lib/api/lists/*
RUN chown -R node:node /home/node
RUN echo %sudo ALL=NOPASSWD: ALL >> /etc/sudoers
WORKDIR /home/node
ENV HOME /home/node
USER node
RUN npm install nightmare
npm install nightmare
will call npm install electron
and this is failing: npm install nightmare
将调用npm install electron
,但失败了:
/usr/local/lib/node_modules/electron/install.js:47
throw err
^
Error: ENOENT: no such file or directory, lstat '/usr/local/lib/node_modules/electron/dist/resources'
at Error (native)
npm ERR! Linux 4.4.0-72-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "electron"
npm ERR! node v6.10.2
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! electron@1.6.6 postinstall: `node install.js`
npm ERR! Exit status 1
Update: this should now be fixed - https://github.com/electron/electron/issues/9323#issuecomment-298287399 更新:现在应该修复-https: //github.com/electron/electron/issues/9323#issuecomment-298287399
This is a bug in a dependency of Electron, there is a workaround : 这是Electron依赖项中的错误,有一种解决方法 :
add "extract-zip": "=1.6.0", to your project's package.json dependencies in the same place where electron dependency located.
在电子依赖项所在的同一位置,将“ extract-zip”:“ = 1.6.0”添加到项目的package.json依赖项中。
Generally speaking this happens because the versions of the dependencies in the dockerfile are not specified. 一般来说,发生这种情况是因为未指定dockerfile中依赖项的版本。
An application can break if its dependencies have a different version than what it was developed with. 如果应用程序的依赖项与开发时使用的版本不同,则该应用程序可能会崩溃。 It's best practice to set the version of most dependencies in the dockerfile so that
apt install
actually installs the same software all the time. 最佳实践是在dockerfile中设置大多数依赖项的版本,以便
apt install
实际上一直都在安装相同的软件。 Some exceptions exist like curl used for a healthcheck which will almost 100% work after an update too 存在一些例外情况,例如用于健康检查的curl,更新后也几乎可以100%工作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.