Unable to install snapcraft snap in docker image(ubuntu:19.10))

Hello Team,

I tried to build an application snap in side my docker image(ubuntu19.10) but when i tried to install snap snapcraft (snap install snapcraft) it shows an error.

i.e error: cannot communicate with server: Post http://localhost/v2/snaps/snapcraft: dial unix /run/snapd.socket: connect: no such file or directory

In side my docker image i have installed snap,snapd & snapcraft
when i tried to check snap version it shows -

root@b9eafe5af357:/# snap version
snap 2.41+19.10.1
snapd unavailable
series -

It seems snapd is not properly installed, when i purge and again installed it is showing the same.

root@b9eafe5af357:/# apt-get install snapd
Reading package lists… Done
Building dependency tree
Reading state information… Done
snapd is already the newest version (2.41+19.10.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

I don’t know why i am getting this error?
Any help is really applicable.


Unfortunately you cannot install snaps/snapd inside docker containers easily.

If all you’re trying to do is build a snap with snapcraft running from inside the docker container, you can use the upstream docker containers at snapcore/snapcraft to build a snap with base: core or base: core16 (i.e. Ubuntu 16.04 Xenial based) or you can build your own image same as snapcore/snapcraft but on Ubuntu 18.04 Bionic based by changing the base of the image to ubuntu:18.04 instead. See https://github.com/snapcore/snapcraft/blob/master/docker/stable.Dockerfile for an example of how to do this