I would like to first say I am not a fan of docker however as a developer from time to time using docker in LXD containers helps with testing prebuilt docker images quickly.
I thought I would share my recent experience setting up docker in an LXD environment on an Ubuntu 18.04 image.
Below are the instructions I used to get a docker image running with full internet access.
lxc launch ubuntu:18.04 dex2 -c security.nesting=true
lxc exec dex2 bash
sudo apt-get update && sudo apt-get upgrade
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt update
apt-cache policy docker-ce
sudo apt install docker-ce
sudo systemctl status docker
docker run hello-world