Start my docker images using commands in my snap

My application uses some docker services for backend processing. So to start those services we have to start by writing some commands. I want to know is there any way we can add those commands inside our yaml file so that when our app starts the command runs and start our docker services?

fyi i am running my electron snap in kiosk mode.

Hi, have a look at https://github.com/anonymouse64/docker-snap-usage-example for an example of how to use the docker snap from your kiosk snap.

1 Like

Okay. I have seen your repo. But i am still confused how can i implement or connect with my other snap. It would be a great help if you can provide steps or a guide to do the same.

i would copy/paste the plugs block (line 10-14) from the snapcraft.yaml into yours, add the docker plug to your app, put the “wrapper.sh” script into your source tree and name it “docker” and use a part with dump plugin to copy it to usr/bin/ inside your snap …

now if your electron app calls the docker command the script gets invoked and a running docker instance (i.e. from the docker snap) should be used through the “docker” and “docker-executables” interfaces