How to run GUI docker without bash terminal

I deployed a java GUI program on docker, and start it in a .sh script:

docker run -it --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix [image_name]

My question is: after the GUI startup, the bash terminal is still showing. Is there any way to exit the terminal after GUI show?

1 Like

You can detach from it with ^P^Q (Ctrl+P, Ctrl+Q) or start it in the background in the first place, using the -d option:

docker run -d -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix [image_name]
2 Likes

It works Thanks very much :slight_smile: