lxc-create在连接到archive.ubuntu.com时卡住了

时间:2016-03-14 16:14:32

标签: linux lxc lxc-docker

我是LXC的新手。我尝试使用命令

创建ubuntu容器
lxc-create -n onos -t ubuntu

安装运行了一段时间,并且卡在下面的消息

Installing Update
Connecting to archive.ubuntu.com

我支持公司代理。 Apt-get更新在主机中正常工作。但是当我尝试创建一个ubuntu容器时,我遇到了上述问题。

有没有人遇到过类似的问题。请帮忙。

1 个答案:

答案 0 :(得分:0)

您应该在lxc-create之前使用代理:

export http_proxy="http://$pre$server:$port/"
export https_proxy=$http_proxy
export ftp_proxy=$http_proxy
export rsync_proxy=$http_proxy
export HTTP_PROXY=$http_proxy
export HTTPS_PROXY=$http_proxy
export FTP_PROXY=$http_proxy
export RSYNC_PROXY=$http_proxy
lxc-create -n onos -t ubuntu

您也可以为apt设置代理:

#cat /etc/apt/apt.conf.d/30proxy 
Acquire::http::proxy "http://proxy:4128";
Acquire::https::proxy "https://proxy:4128";

PS:

bug lxc-create doesn't take advantage of the apt proxy

Here: lxc-create not working behind proxy解决方案是:

  

apt没有问题,但是我有使用debootstrap的问题。有   在/ etc / wgetrc中设置代理设置。一切都很好。