We can install docker on Ubuntu Core as a snap by issuing:

$ snap install docker

If you get the following output:

error: cannot communicate with server: Post http://localhost/v2/snaps/docker: dial unix /run/snapd.socket: connect: connection refused

Then possibly the snap deamon failed to start properly. We can check it’s status by issuing:

sudo systemctl status snapd

Output will look something like this:

● snapd.service - Snappy daemon
Loaded: loaded (/lib/systemd/system/snapd.service; enabled; vendor preset: enabled)
Active: inactive (dead) (Result: exit-code) since Tue 2017-03-14 20:01:52 UTC; 4 months 11 days ago
Process: 1414 ExecStart=/usr/lib/snapd/snapd (code=exited, status=2)
Main PID: 1414 (code=exited, status=2)
Mar 14 20:01:52 localhost.localdomain snapd[1414]: github.com/snapcore/snapd/vendor/gopkg.in/tomb%2ev2.(*Tomb).run(0x34c52480, 0x34c51c30)
Mar 14 20:01:52 localhost.localdomain snapd[1414]:         /build/snapd-QKKsNH/snapd-2.23.1/_build/src/github.com/snapcore/snapd/vendor/gopkg.in/tomb.v2/tomb.go:163 +0x1c
Mar 14 20:01:52 localhost.localdomain snapd[1414]: created by github.com/snapcore/snapd/vendor/gopkg.in/tomb%2ev2.(*Tomb).Go
Mar 14 20:01:52 localhost.localdomain snapd[1414]:         /build/snapd-QKKsNH/snapd-2.23.1/_build/src/github.com/snapcore/snapd/vendor/gopkg.in/tomb.v2/tomb.go:159 +0x134
Mar 14 20:01:52 localhost.localdomain systemd[1]: snapd.service: Unit entered failed state.
Mar 14 20:01:52 localhost.localdomain systemd[1]: snapd.service: Failed with result 'exit-code'.
Mar 14 20:01:52 localhost.localdomain systemd[1]: snapd.service: Service hold-off time over, scheduling restart.
Mar 14 20:01:52 localhost.localdomain systemd[1]: Stopped Snappy daemon.
Mar 14 20:01:52 localhost.localdomain systemd[1]: snapd.service: Start request repeated too quickly.
Mar 14 20:01:52 localhost.localdomain systemd[1]: Failed to start Snappy daemon.

We can manually (re)start the snap daemon:

sudo systemctl restart snapd

Now the output should look something like this:

● snapd.service - Snappy daemon
Loaded: loaded (/lib/systemd/system/snapd.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2017-07-25 19:21:11 UTC; 2s ago
Main PID: 1592 (snapd)
CGroup: /system.slice/snapd.service
└─1592 /usr/lib/snapd/snapd
Jul 25 19:21:11 localhost.localdomain systemd[1]: Started Snappy daemon.
Jul 25 19:21:11 localhost.localdomain /usr/lib/snapd/snapd[1592]: snapmgr.go:373: DEBUG: snapmgr refresh randomness 23m1.694366125s
Jul 25 19:21:11 localhost.localdomain /usr/lib/snapd/snapd[1592]: daemon.go:250: DEBUG: init done in 6.557996ms
Jul 25 19:21:11 localhost.localdomain /usr/lib/snapd/snapd[1592]: daemon.go:251: started snapd/2.23.1 (series 16) ubuntu-core/16 (armhf) linux/4.4.0-1030-raspi2.
Jul 25 19:21:11 localhost.localdomain snapd[1592]: 2017/07/25 19:21:11.176894 daemon.go:251: started snapd/2.23.1 (series 16) ubuntu-core/16 (armhf) linux/4.4.0-1030-raspi2.