我在docker上安装了Ubuntu 14.04镜像.之后,当我尝试在ubuntu映像中安装软件包时,我无法找到软件包错误:
apt-get install curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package curl
Run Code Online (Sandbox Code Playgroud)
如何解决这个错误?
我正在运行一个带有docker的虚拟机(Ubuntu 13.10)(版本0.8.1,构建a1598d1).我正在尝试使用dockerfile构建映像.首先,我想更新软件包(使用下面的代码 - 代理被混淆)但apt-get超时错误:Could not resolve 'archive.ubuntu.com'.
FROM ubuntu:13.10
ENV HTTP_PROXY <HTTP_PROXY>
ENV HTTPS_PROXY <HTTPS_PROXY>
RUN export http_proxy=$HTTP_PROXY
RUN export https_proxy=$HTTPS_PROXY
RUN apt-get update && apt-get upgrade
Run Code Online (Sandbox Code Playgroud)
我还在主机系统中运行以下命令:
sudo HTTP_PROXY=http://<PROXY_DETAILS>/ docker -d &
Run Code Online (Sandbox Code Playgroud)
主机能够apt-get毫无问题地运行.
如何更改dockerfile以允许它从容器内到达ubuntu服务器?
更新
我在CentOS中运行代码(更改FROM ubuntu:13.10为FROM centos),它运行正常.这似乎是Ubuntu的一个问题.
答案:我仍然不知道出了什么问题,但是在我重新启动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 …Run Code Online (Sandbox Code Playgroud)