Closed marisancans closed 2 years ago
The image also doesn't return the exit code from the run.sh file or any custom command passed
Hello,
this image is designed to keep running in the background by default. Please check the full Readme, especially the parts Running containers in background (detached), Running containers in foreground (interactively) and Startup options and help.
There are actually several ways how to make it to quit after running your command or script. I'll mention only some of them.
You can provide the --skip-startup
option and your command/script as a parameter.
In the following example it's the whoami
command, which is executed inside the container:
docker run accetto/ubuntu-vnc-xfce-g3 --skip-startup whoami
There are also other parameters you can use. You can list them by executing
docker run accetto/ubuntu-vnc-xfce-g3 -h
(for concise help)
or
docker run accetto/ubuntu-vnc-xfce-g3 -H
(for extended help)
You can also run the container interactively and let Docker to destroy it by providing the parameters -it --rm
. Then type CTRL-C
at the end and the container will be stopped and removed. Actually, the parameter -it
ist optional.
docker run --rm docker run accetto/ubuntu-vnc-xfce-g3 whoami
docker run -it --rm docker run accetto/ubuntu-vnc-xfce-g3 whoami
The containers created from this image do not return anything by default, because they are intended for other kind of use.
However, you can do it easily by echoing your result like this:
docker run accetto/ubuntu-vnc-xfce-g3 --skip-startup echo "My result code is 999"
I hope I've helped you.
Best regards, accetto
No further actions from the requester. Closing the issue.
Lets say I run a docker image:
docker run -p 49154:5901 -p 49153:6901 accetto/ubuntu-vnc-xfce-g3:latest-fugo /home/headless/run.sh
Where run.sh file contains a simple bash script:
And test.py contains:
Shouldn't the image be killed when command is executed also successfully?
How do I exit the image if the program is successful?