Ubuntu – `snap` fails from inside docker container

dockersnap

I pulled the latest Ubuntu image from hub.docker.com

$ docker pull ubuntu

Everything downloaded correctly so I launched the container

$ docker run -it ubuntu

I installed snapd into the container

# apt update
...
All packages are up to date.
# apt install snapd
Get:1 http://security.ubuntu.com/...
...
done.

When I try to login, I am getting a failure

# snap login
2017/04/20 18:06:04.729212 main.go:220: WARNING: cannot create syslog logger
Email address: <me@email.com>
Password of "me@email.com":
error: cannot communicate with server: Post http://localhost/v2/login: dial unix /run/snapd-snap.socket: connect: no such file or directory

I even tried sudo just to be sure…

# sudo snap login
bash: sudo: command not found

Best Answer

It takes more than that to get snapd working inside a Docker container. Check out Ogra's container here: https://github.com/ogra1/snapd-docker

Related Question