ubuntu – 在构建Docker镜像时无法找到包

在我的Docker容器构建过程中,我尝试使用apt-get install安装一些软件包.但是,该过程未能完成,因为无法找到4个包中的3个.

Step 1 : RUN apt-get update  && apt-get install -y netcat  ca-certificates  build-essential  libssl-dev
 ---> Running in 38d22d97ec4a
Err http://http.debian.net jessie InRelease

Err http://http.debian.net jessie-updates InRelease

Err http://security.debian.org jessie/updates InRelease

Err http://http.debian.net jessie Release.gpg
  Could not resolve 'http.debian.net'
Err http://security.debian.org jessie/updates Release.gpg
  Could not resolve 'security.debian.org'
Err http://http.debian.net jessie-updates Release.gpg
  Could not resolve 'http.debian.net'
Reading package lists...
W: Failed to fetch http://http.debian.net/debian/dists/jessie/InRelease

W: Failed to fetch http://http.debian.net/debian/dists/jessie-updates/InRelease 

W: Failed to fetch http://security.debian.org/dists/jessie/updates/InRelease

W: Failed to fetch http://http.debian.net/debian/dists/jessie/Release.gpg  Could not resolve 'http.debian.net'

W: Failed to fetch http://http.debian.net/debian/dists/jessie-updates/Release.gpg  Could not resolve 'http.debian.net'

W: Failed to fetch http://security.debian.org/dists/jessie/updates/Release.gpg  Could not resolve 'security.debian.org'

W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package netcat
E: Unable to locate package build-essential
E: Unable to locate package libssl-dev
Removing intermediate container 38d22d97ec4a
2015/08/10 12:03:07 The command [/bin/sh -c apt-get update  && apt-get install -y netcat  ca-certificates  build-essential  libssl-dev] returned a non-zero code: 100

起初,我认为这是我的基本映像的问题,但是我在另一个VM上构建容器没有问题.思考?

我在一个基于相同问题的新问题中找到了这个答案,它为我解决了这个问题.

$docker-machine restart default      # Restart the environment
$eval $(docker-machine env default)  # Refresh your environment settings

答案由Mark Smith提供.

相关文章
相关标签/搜索