简体   繁体   English

尽管使用集线器中所示的相同Dockerfile重建Docker映像失败

[英]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.

相关问题 如果我从 Docker 集线器引用没有后缀的图像,将准确使用哪个 Dockerfile? - If I reference an Image from Docker hub without suffix, which Dockerfile will be exactly used? Docker 容器/映像不会在代码修改时自动重建 - Docker container/image is not rebuilding automatically on code amendment 如何使用包含数据库创建的 dockerfile 构建 docker 镜像 - How to build an docker image using dockerfile which includes databases creation 如何在不重建整个图像的情况下编辑 docker 图像中的文件? - How to edit a file inside a docker image without rebuilding the entire image? 如何将Dockerfile转换为docker compose图像? - How to convert a Dockerfile to a docker compose image? 无法使用 gcloud app deploy 推送 docker 镜像 - Failing to push docker image using gcloud app deploy 当Dockerfile不在Docker Hub的根目录中时,“复制失败:未指定源文件” - “COPY failed: no source files were specified” when Dockerfile is not in root directory on Docker Hub 使用 SSH 代理与 Docker 组合和 Dockerfile - Using SSH agent with Docker Compose and Dockerfile ./asinstall 在使用 dockerfile 进行 docker 构建时未找到? - ./asinstall not found in while docker build using dockerfile? Dockerfile - 为多个 Node.js 应用构建 docker 图像 - Dockerfile - Build docker image for multiple Node.js app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM