LXD

LXD website

Basics

Create container

sudo lxc launch ubuntu:18.04 CONTAINER_NAME

You can then enter the newly created container by running:

sudo lxc exec CONTAINER_NAME bash

Port forwarding

sudo lxc config device add CONTAINER_NAME PROXY_NAME proxy listen=tcp:0.0.0.0:PUBLIC_PORT connect=tcp:127.0.0.1:CONTAINER_PORT

Examples

sudo lxc config device add haproxy haproxy-80 proxy listen=tcp:0.0.0.0:80 connect=tcp:127.0.0.1:80

Further reading

Share folders

sudo lxc config device add CONTAINER_NAME SHARE_NAME disk path=PATH_ON_GUEST source=PATH_ON_HOST

Examples

sudo lxc config device add web01 shared-stats disk path=/var/www/stats source=/var/www/stats

Further reading