apt-get在Dockerfile中不起作用

Min*_*Han 1 windows apt-get node.js docker

答案:我仍然不知道出了什么问题,但是在我重新启动docker并再次运行它(相同的dockerfile,同样的一切)后,它运行正常.

我在Windows上使用Docker而我的Dockerfile是

FROM ubuntu:15.04

COPY . /src

RUN apt-get update 
RUN apt-get install -y nodejs 
...etc
Run Code Online (Sandbox Code Playgroud)

但是当我尝试构建我得到的图像时

WARN[0001] SECURITY WARNING: You are building a Docker image from Windows against a Linux Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories

...

Step 3: RUN apt-get -y update
 --> Using cache
 --->ccd4120f98dd
Removing intermediate container 255796bdef29
Step 4: RUN apt-get install -y nodejs
 ---> Running in f6c1d5a54c7a
Reading package lists...
Reading dependency tree...
Reading state information...
E: Unable to locate package nodejs
INFO[0029] The command [/bin/sh -c apt-get install -y nodejs] returned a non-zero code:100
Run Code Online (Sandbox Code Playgroud)

apt-get工作,但是当我尝试将其他apt-get安装行放在那些不起作用时,它似乎不是一个问题.

Abd*_*aly 9

我不得不把它作为答案,因为我无法在评论中进行格式化

应该有更多的输出来描述出错的地方.尝试在临时容器内迭代运行这些步骤:

docker run --rm -it ubuntu:15.04 bash -l
apt-get update
apt-get install -y nodejs
Run Code Online (Sandbox Code Playgroud)

这能为您提供更多关于破坏的信息吗?

UPDATE

试试这个并迭代它:

FROM ubuntu:15.04
RUN apt-get update && apt-get install -y nodejs
Run Code Online (Sandbox Code Playgroud)


Vic*_*olf 5

我将两行分开:

RUN apt-get update
RUN apt-get install -y nodejs
Run Code Online (Sandbox Code Playgroud)

发现问题出在apt-get udpate.

尝试了 Abulla 的建议,apt-get update 工作正常。

删除并重新RUN apt-get update键入我的 Dockerfile 中的行,一切正常。