How to use the localhost cloud offline

See also:

Here we present a popular offline use case of using a non-remote LXD-based cloud in a network-restricted environment.

Begin by defining the HTTP and HTTPS proxies. In this example they happen to be the same:


Now we employ a slightly ingenious method to define the ‘no proxy’ settings in order to prevent some destinations, the LXD host in particular, from using the proxies (see No proxy and the localhost cloud for clarity):

PROXY_NO=$(echo localhost 10.44.139.{1..255} | sed 's/ /,/g')

Besides those related to the local system, you will need to change these values according to your specific setup.

Configure the client to use these three settings:

export http_proxy=$PROXY_HTTP
export https_proxy=$PROXY_HTTP
export no_proxy=$PROXY_NO

Finally, apply these settings to all models during the controller-creation process:

juju bootstrap \
--model-default http-proxy=$PROXY_HTTP \
--model-default https-proxy=$PROXY_HTTPS \
--model-default no-proxy=$PROXY_NO \
localhost lxd

Last updated 4 months ago. Help improve this document in the forum.