Docker Community Forums

Share and learn in the Docker community.

Shutdown/restart the container with gui application close event?


(Ep4sh) #1

I made docker image with GUI. Super! Fantastic!
Also i made shortcut for user - shell script (we use Debian):

docker run --rm -t --name=myapp -e DISPLAY -v $HOME/.Xauthority:/home/user/.Xauthority -v $HOME:/home/user -v /media:/mnt --net=host --pid=host --ipc=host ep4sh/1c-8312-1469

User can close this containerized app, but the container still UP.

ep4sh@PC:~$ docker ps
CONTAINER ID        IMAGE                COMMAND                  CREATED             STATUS              PORTS               NAMES
cdfa3ff78152        ep4sh/1c-8312-1469   "/bin/sh -c /opt/sta…"   12 minutes ago      12 minutes ago                           myapp

So user can open / close app many times, but PC resources will end soon.

How can i shutdown/restart the container with app close event?

Or may be there is another way? Any elegant solution?
Thanks for help! I just start my docker way, please dont angry :slight_smile: