Using docker for clean builds of classic snaps
Joseph Rushton Wakeling
joseph.wakeling at webdrake.net
Sun Feb 5 22:51:41 UTC 2017
On 05/02/17 19:33, Loïc Minier wrote:
> I dont think "snapd" is in the "ubuntu" Docker image which is trimmed down a
> bit
Yes, I gathered that much, which is why my own Dockerfile attempt ensured that
snapd would be installed with this line:
RUN apt-get --assume-yes install snapd snapcraft
... but as you say:
> it's also likely that snapd/snaps would hit some technical issues when
> inside Docker. (This might be worth researching/debugging if you're tempted.)
It looks to me like the snapd daemon doesn't actually run inside the container.
If I try something simple like checking the version of snapd installed, then I
get this output:
$ sudo docker run -v $PWD:$PWD -w $PWD 592f87a670d0 snap --version
2017/02/05 22:43:59.308309 main.go:220: WARNING: cannot create syslog logger
snap 2.21
snapd unavailable
series -
... so it's clearly installed in my custom image, but not started.
If I _do_ try starting it as part of the command to run in the container, I get
the following:
$ sudo docker run -v $PWD:$PWD -w $PWD 592f87a670d0 systemctl enable --now
snapd.socket && snap install core && snapcraft clean && snapcraft
error: access denied (try with sudo)
Trying `sudo` (as in `sudo systemctl enable ...`) doesn't seem to make any
difference.
Any thoughts on what else I could try? I'm happy to keep exploring myself but
Docker and sockets aren't really my area of expertise.
I would imagine, though, that the kinds of issues I'm running into with Docker
are fundamentally the same issues that make it hard for classic snaps to support
`snapcraft cleanbuild` using lxd ... ?
Thanks & best wishes,
-- Joe
More information about the Snapcraft
mailing list