How to perform auto-reconnection to the Docker interfaces

Hi,
I’v decided to create a snap for my dockerized service and my cli tool in order to simplify the installation process for the users.

But as I understand it, the users needs to understand the “snap connections” concept and to connect manually some of the interfaces… I think that it really complicating the installation process and raises questions and concerns to the users because some of them are not familiar with the snap connections or snap at all.

There is a solution or workaround for that issue?

I’m attaching my snapcraft.yaml so maybe I’m doing something not ideal and you can advice.

name: my-app
version: '1.0.0'
summary: |
  My App
description: |
  Some My App Description.

grade: devel
confinement: strict

plugs:
  docker-cli:
    interface: docker
  docker-executables:
    content: docker-executables
    default-provider: docker
    interface: content
    target: docker-env
  config-myapp:
    interface: system-files
    read:
    - /mnt/myapp
  log-access:
    interface: system-files
    read:
    - /logs/myapp-cli.log

parts:
  environment:
    plugin: dump
    source: ./src/
    organize:
      'docker-wrapper' : bin/
  jre:
    source-type: tar
    source: ./jre-source/zulu11.33.10-sa-jre11.0.4-linux_x64.tar.gz
    plugin: dump
  myapp-cli:
    source-type: local
    source: ./myapp-cli-source
    plugin: dump


apps:
  mya-pp:
    command: ./bin/java -jar $SNAP/myapp-cli-1.0.602.jar
    plugs: [network, log-access]
  my-app-service:
    command: myapp-docker-deploy
    plugs: [docker-executables, docker-cli, config-myapp, network]
    daemon: simple

Thanks!

Snaps will typically check if the interface is connected and report back to the user something useful. Eg, a user experience for your application might be:

$ sudo snap install my-app
$ my-app.docker-cli ...
Could not connect to docker. Perhaps run 'sudo snap connect my-app:docker'?

It is on the roadmap that snapd provide a convenient method to verify if an interface is connected, but for now you can try to connect to the docker socket and check for errors. Perhaps run ‘docker version’ which will communicate over the unix socket for ‘Server:’ information.