(based on https://lists.ubuntu.com/archives/snapcraft/2016-October/001382.html and https://docs.docker.com/engine/getstarted/)
Search for the snap:
$ snap find docker
Name Version Developer Notes Summary
docker 1.11.2-9 canonical - The docker app deployment mechanism
j2 0.3.1-0 cmars - Command-line interface to Jinja2 for templating in shell scripts.
Add the docker group:
$ sudo groupadd --system docker
Install the snap:
$ sudo snap install docker
docker (stable) 1.11.2-9 from 'canonical' installed
Connect the interfaces:
$ sudo snap connect docker:docker-cli docker:docker-daemon
$ sudo snap connect docker:firewall-control ubuntu-core:firewall-control
$ sudo snap connect docker:support ubuntu-core:docker-support
Restart the service:
$ sudo service snap.docker.dockerd stop
$ sudo service snap.docker.dockerd start
Verify the installation:
$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
c04b14da8d14: Pull complete
Digest: sha256:0256e8a36e2070f7bf2d0b0763dbabdd67798512411de4cdcf9431a1feb60fd9
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
[...]
Show the containers in the system:
$ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cbcdc2e117ff hello-world "/hello" About a minute ago Exited (0) About a minute ago insane_brahmagupta
Run bash in an ubuntu container:
$ sudo docker run -it ubuntu bash
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
6bbedd9b76a4: Pull complete
fc19d60a83f1: Pull complete
de413bb911fd: Pull complete
2879a7ad3144: Pull complete
668604fde02e: Pull complete
Digest: sha256:2d44ae143feeb36f4c898d32ed2ab2dffeb3a573d2d8928646dfc9cb7deb1315
Status: Downloaded newer image for ubuntu:latest
root@c72005d1b090:/# apt install update
root@c72005d1b090:/# apt install -y lsb-release
[...]
root@c72005d1b090:/# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.1 LTS
Release: 16.04
Codename: xenial
Tested in an ubuntu classic xenial kvm.
Everything works, but there are some denials logged by snappy-debug: https://paste.ubuntu.com/23415131/