apt-get不能在Dockerfile中工作 [英] apt-get not working in Dockerfile

查看:514
本文介绍了apt-get不能在Dockerfile中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ANSWER :我仍然不知道什么是错误的,但是在重新启动docker并再次运行(同样的Dockerfile,相同的一切)之后,它工作正常。



我在Windows上使用Docker,而Dockerfile是

  FROM ubuntu:15.04 

COPY。 / src

运行apt-get更新
运行apt-get install -y nodejs
... etc

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

  WARN [ 0001]安全警告:您正在从Windows Docker主机上构建Docker映像。添加到构建上下文中的所有文件和目录将具有'-rwxr-xr-x'权限。建议对敏感文件和目录进行双重检查和重置权限

...

步骤3:运行apt-get -y update
- > ;使用缓存
---> ccd4120f98dd
删除中间容器255796bdef29
步骤4:运行apt-get install -y nodejs
--->运行在f6c1d5a54c7a
读取包列表...
读取依赖关系树...
读取状态信息...
E:无法找到包nodejs
INFO [ [/ bin / sh -c apt-get install -y nodejs]命令返回一个非零代码:100

apt-get工作,但是当我尝试将其他apt-get安装行放在那些不工作的时候,所以似乎不是一个问题,



谢谢!

解决方案

我重新启动了docker并再次尝试,现在可以正常工作。 $ b

ANSWER: I still don't know what was really wrong but after I restarted docker and ran it again (same dockerfile, same everything), it worked fine.

I'm using Docker on Windows and my Dockerfile is

FROM ubuntu:15.04

COPY . /src

RUN apt-get update 
RUN apt-get install -y nodejs 
...etc

but when I try to build the image I get

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

apt-get works but when I try to put other apt-get install lines in those don't work either so it doesn't seem to be a problem with

Thanks!

解决方案

I restarted docker and tried again and now it works fine.

这篇关于apt-get不能在Dockerfile中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆