Provision a LXC Container:
container_name=jenkins-docker-node-01
lxc init images:debian/10/cloud $container_name
lxc config set $container_name limits.memory 2048MB
lxc config set $container_name security.privileged true
lxc config set $container_name security.nesting true
lxc config set $container_name security.privileged true
cat <<EOT | lxc config set $container_name raw.lxc -
lxc.cgroup.devices.allow = a
lxc.cap.drop =
EOT
lxc start $container_name
Install Docker:
$ apt update
$ apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common -y
$ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
$ add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
$ apt update
$ apt install docker-ce -y
$ systemctl enable docker
$ systemctl restart docker
Run a Container:
$ docker run -it busybox cat /etc/hostname
Unable to find image 'busybox:latest' locally
latest: Pulling from library/busybox
0f8c40e1270f: Already exists
Digest: sha256:1303dbf110c57f3edf68d9f5a16c082ec06c4cf7604831669faf2c712260b5a0
Status: Downloaded newer image for busybox:latest
baf4e8bc36a0