【发布时间】:2015-04-28 20:43:34
【问题描述】:
我正在使用基于dockerfile/ubuntu 的图像nginx。关于附加到 docker 容器的外壳
docker exec -it <container_id> /bin/bash
我想做一个git pull 所以我尝试安装git 但apt 找不到包:
root@a71e45d5cd40:/# apt-get install git
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package git
我们如何从该图像安装git,为什么它会丢失?
cat /etc/apt/sources.list
deb http://httpredir.debian.org/debian wheezy main
deb http://httpredir.debian.org/debian wheezy-updates main
deb http://security.debian.org wheezy/updates main
deb http://nginx.org/packages/mainline/debian/ wheezy nginx
cat /etc/apt/sources.list.d/*
cat: /etc/apt/sources.list.d/*: No such file or directory
apt-cache 麦迪逊 git
N: Unable to locate package git
【问题讨论】:
-
root@....你已经是超级用户,所以sudo不存在afaik。 -
@SeanKenny 谢谢,让我重新表述这个问题
-
显示
cat /etc/apt/sources.list、cat /etc/apt/sources.list.d/*和apt-cache madison git进行诊断。 -
鉴于这是 docker,git 可能不是
/etc/apt/sources.list(.d/)中带有 apt 的“注册”包(因为需要更好的词)。我不是 100% 确定 Docker 在这方面是如何工作的。 -
@DmitryVerkhoturov 更新了这些命令的输出问题