lxc-create stuck at connecting to archive.ubuntu.com

1.3k Views Asked by At

I am new to LXC. I tried to create ubuntu container using the command

lxc-create -n onos -t ubuntu

The installation ran for some time and got stuck with below message

Installing Update
Connecting to archive.ubuntu.com

I am behind corporate proxy. Apt-get update works fine in host. But when I try to create a ubuntu container I am having the above issue.

Did anyone faced similar issue. Please help.

1

There are 1 best solutions below

0
On

You should use proxy before 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

Also you can setup the proxy for 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 a solution was:

There was no problem with apt but, I had issue using debootstrap. Had to set up the proxy settings in /etc/wgetrc. All fine now.