Access to /usr/bin/docker

I am building a snap that will call the docker binary to create a container. However, I am getting this error:

  File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'docker'

Would that be resolved if I added the docker plug?

There’s an example of how to use docker from a strictly confined snap here: https://github.com/anonymouse64/docker-snap-usage-example

Thanks Ian for the example!

How would I execute a binary that was not part of a snap though and was installed via a package? I installed docker via the docker.io package.

I built the snap from your repository and ran

$ snap connect docker-snap-usage-example:docker-executables docker:docker-executable error: snap "docker" has no slot named "docker-executable"

Am I missing something?

Thanks!|