Full support for proxies was added with the 1.18.0 release of Juju.
From the release notes:
Support for proxies
Proxies can now be configured for the providers in the environments.yaml
file, or added to an existing environment using "juju set-env" The
configuration options are:
http-proxy
https-proxy
ftp-proxy
no-proxy
The protocol-specific options accept a URL. The "no-proxy" option
accepts a comma-separated list of host names or addresses.
The proxy options are exported in all hook execution contexts, and also
available in the shell through "juju ssh" or "juju run".
There are three additional proxy options specific for apt. These are set
to be the same as the non-apt proxy values, but can be overridden
independently:
apt-http-proxy
apt-https-proxy
apt-ftp-proxy
For example, with a squid-deb-proxy running on a laptop, you can specify
the apt-http-proxy to use it for the containers by specifying the host
machine’s network-bridge:
apt-http-proxy: http://10.0.3.1:8000
For the 2.0 release of Juju, there is no way to set the environment globally before a model is created, but you can create a config.yaml file, containing the following:
default-series: xenial
no-proxy: localhost
apt-http-proxy: http://<ip address>:<port>
apt-https-proxy: https://<ip address>:<port>
apt-ftp-proxy: ftp://<ip address>:<port>
http-proxy: http://<ip address>:<port>
https-proxy: https://<ip address>:<port>
ftp-proxy: ftp://<ip address>:<port>
You can then use the --config option to tell Juju to use this file (I store mine in ~/.juju/). For example, juju bootstrap localhost lxd-test --config=config.yaml.