Connecting docker snap to system daemon

I remember this being covered in a topic here a while back, but I’ve had a good old look and I can’t find it now.

I believe there’s a way to install the docker snap, but have it just act as an interface to running system docker.

Basically, I am building a snap that I want to be able to run docker containers, but the docker snap is too outdated for my uses. I believe in this case I can instead install the system docker as per the docker install instructions and then tell the docker snap to connect to the system docker, and then connect my snap to the docker snap.

Is that accurate? How would I do this?

What you would do in this case (as of this writing):

  1. install docker snap: snap install docker
  2. disable dockerd from the docker snap with snap stop --disable docker
  3. install docker from wherever you need: ...
  4. install your snap that wants to use docker: snap install ...
  5. connect your snap’s docker plug to the docker snap’s docker plug: snap connect <your-snap>:docker docker:docker-daemon

Hope this helps.

BTW, are you sure that the docker snap version is too old? The current stable snap is at 19.03.11 which is from June 2020, and the edge channel of the docker snap is at 19.03.13 2020, which was released in September. You can install the edge version with snap install docker --edge or just to switch to edge after you have it installed, snap refresh docker --edge. If you have issues with the docker snap, please file issues at the (new) repository at - that is more actively maintained than the old Launchpad project, so hopefully you can get assistance if you have troubles with the docker snap.

Thanks that’s perfect.

Ah, I’d heard the docker snap wasn’t being maintained, good to know that it is. The specific issue I get is, I think, that buildkit cache mounts don’t seem to work in the snap version. I’ll try to file an issue about it.