Can't access to docker snap

I install docker-snap, when i build my snap package with golang. It has function for executing bash cmds, and when i try to exucute any docker commands (“sudo docker ps” like example) i get an errror.

it helps to actually include the error you get in such posts :wink:

English in’t my native language and I’m sorry. But if you know answer, please help me.

please include the error message you get, else nobody can help you.

I think error’s text is useless. Any other bash cmds works good.
2017/07/04 17:32:42 could not greet: rpc error: code = Unknown desc = exit status 1
exit status 1

is the user in the docker group ?

I don’t know this. I use “sudo” and anyway it must ignore group or am i wrong?

Please run the “docker.help” command, it should tell you how to prepare the system (I am not sure if sudo helps with the snap)

it tell: “sudo snap connect docker:home :home”. I run this command, this is doesn’t help(

after you created the group and added the user to it ?

Yes, after all manipulations problem doesn’tt throw away

if you use the “groups” command, is docker listed there ?

docker in snap container, i use “sudo classic” and there use group commands

why do you use “sudo classic” are you on a development board in an ubuntu core image ?

Hi Licvid
1. Did you define a plug in your snapcraft.yaml file to connect the slot(docker-executables) declared in docker-snap?
https://github.com/adglkh/dockerized-app-snap/blob/master/snap/snapcraft.yaml#L19
2. Did you connect all relevant plugs after your snap first installation? The reason here is that you need to connect them as you built your snap locally.
Here is the guide you can follow up to create your own dockerized-based snap.
https://github.com/adglkh/dockerized-app-snap
Please let me know if you have any further questions.

Thanks.
Gary

Hello, Gary. Can you see my snapcraft.yaml, any mistakes?

name: sqdron # you probably want to 'snapcraft register ’
version: ‘1.0’ # just for humans, typically ‘1.2+git’ or ‘1.3.2’
summary: Something # 79 char long summary
description: |
All right.

grade: stable
confinement: strict

plugs:
support:
interface: docker-support
privileged:
interface: docker-support
privileged-containers: true
docker-cli:
interface: docker
slots:
server-daemon:
interface: docker
docker-executables:
content: docker-executables
interface: content
read:
- .

apps:
sqdron:
command: bin/agentlocal
server:
command: bin/server
daemon: simple
restart-condition: always
plugs:
- network-bind
- firewall-control
- support
- privileged
- home
slots:
- server-daemon

parts:
sqdron:
plugin: go
source: .
server:
plugin: go
source: …/server

For your dockerized snap, there’s no need to declare slots in your snap(consumer) if you try to use docker command shared by docker-snap(producer). The slots are needed to be declared on producer end.

For any bash where you invoke the docker or docker-compose, you need to append docker-executables and docker-cli in plugs field and connect them upon installation to get the privilege to run docker command within your snap sandbox.

Meanwhile, as we announced in this thread, we just added the content-interface support in latest version docker-snap and promoted them to candidate channel of the respective tracks.

  • Latest/candidate: 17.03.2-ce-1
  • 17.03/candidate: 17.03.2-ce-1
  • 17.06/candidate: 17.06.0-ce-1

So you need to refresh your docker snap to one of those three if you install the snap from stable channel.

snap refresh docker --candidate

or install it from candidate channel from latest track directly.

snap install docker --candidate

I’d recommend taking a look at this thread to learn how to use content-interface in the snap, especially on the consumer end.
Also It would be better if you can upload your whole project somewhere github or launchpad, then I can take a closer look if you have any further question.

Cheers
Gary

Nothing help(
full project https://github.com/Licvid/test

Hi
I created a PR. Please take a look.
To have a quick verification, you need to run snapcraft against my branch to build snap package firstly.
Then install your snap with dangerous option added as it’s fully confined

$ snap install --dangerous docker-app_0.1_amd64.snap

And connect the relevant plugs upson installation since you build it locally

$snap connect docker-app:privileged :docker-support
$snap connect docker-app:support :docker-support
$snap connect docker-app:docker-cli docker:docker-daemon
$snap connect docker-app:docker-executables  docker:docker-executables

Finally, run docker-app.sqdron command and check the print-out

Note: you’re not allowed to install another snap within you snap sandbox in confinement mode due to the apparmor denials. Also you need to drop sudo in your code for the same reason. So I commented that line. If your snap replies on docker-snap to function, you need to ask users to install it in advance by themselves.

2 Likes

OH, thanks for your big work! It’s work on amd64, it’s nice, but i develop my app for raspberry pi. Does ARM version of docker-wrapper exist(i work with ubuntu core if this is something mean)? Now i get this error, when try snapcraft on my raspberry

The specified command ‘docker-wrapper’ defined in the app ‘sqdron’ does not exist or is not executable