If I try to run snap under a gitlab-CI pipeline, installing the most simple package, it fails with:

$ snap install hello-world

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

The gitlab-ci yml configuration file is the simplest ever:

image: ubuntu:18.04

before_script:
  - apt-get update -qq

test:
  script:
    - apt-get install -y snapd
    - snap version
    - snap install hello-world
    - hello-world

What's going on?

1 Answers

0
Kyle On

Unfortunately, snaps use many of the underlying security tech used by docker, and they don't play very nicely. Installing a snap also requires snapd to be running, which it's not in docker (hence the error). I'm afraid you simply cannot reliably install snaps in docker containers today.