CONTAINER=haproxy # Create container lxc launch ubuntu:18.04 ${CONTAINER} sleep 10 # Deploy SSH key lxc file push --uid 0 --gid 0 --mode 600 ~/.ssh/id_rsa.pub ${CONTAINER}/root/.ssh/authorized_keys # Configure http(s) proxy inside of container (if set on host) [ -z ${http_proxy} ] || echo "export http_proxy=$http_proxy" | lxc shell ${CONTAINER} -- tee -a /etc/environment [ -z ${https_proxy} ] || echo "export https_proxy=$https_proxy" | lxc shell ${CONTAINER} -- tee -a /etc/environment # Update APT repository lxc exec ${CONTAINER} -- bash -c ". /etc/environment && apt update" # Optional: install applications lxc exec ${CONTAINER} -- bash -c ". /etc/environment && apt install -y haproxy"