Using docker for clean builds of classic snaps

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Sun Feb 5 14:13:34 UTC 2017


On 02/02/17 22:35, Loïc Minier wrote:
> There are a bunch of Docker images providing snapcraft
> <https://hub.docker.com/search/?isAutomated=0&isOfficial=0&page=1&pullCount=0&q=snapcraft&starCount=0>,
> unfortunately they are all behind. These should be autobuilt instead of manually
> updated, in the mean time I suggest you build your own (relatively easy)
> <https://hub.docker.com/r/sergiusens/snapcraft/~/dockerfile/>. Otherwise,
> Didier's image <https://hub.docker.com/r/didrocks/snapcraft/builds/> is only a
> month old and should include a snapcraft with experimental support for classic
> snaps.

Thanks Loïc :-)

Images like the ones you point to match pretty much what I came up with myself, 
but I ran into difficulties installing the core snap (required for building 
classic snaps).

My Dockerfile was as follows:

##################################################

FROM ubuntu:16.04

RUN apt-get update
RUN apt-get --assume-yes dist-upgrade
RUN apt-get --assume-yes install snapd snapcraft
RUN snap install core

##################################################

... and when building the image, it would fall over at the last step:

Step 5/5 : RUN snap install core
  ---> Running in fb52514fbd30
2017/02/05 13:59:56.811387 main.go:220: WARNING: cannot create syslog logger
error: cannot communicate with server: Post http://localhost/v2/snaps/core: dial 
unix /run/snapd-snap.socket: connect: no such file or directory

I would get a similar error if I tried deleting the last line of the Dockerfile 
but running `snap install core` manually in the container:

$ sudo docker run -v $PWD:$PWD -w $PWD [my-image-id] snap install core && 
snapcraft clean && snapcraft
2017/02/05 14:07:35.998824 main.go:220: WARNING: cannot create syslog logger
error: cannot communicate with server: Post http://localhost/v2/snaps/core: dial 
unix /run/snapd-snap.socket: connect: no such file or directory

I presume I'm missing something here in terms of setting up sockets for the 
image/container?

Thanks & best wishes,

     -- Joe




More information about the Snapcraft mailing list