- How to restart the ROS docker container with GUI enabled? (Points to note: restart & with GUI!)
Following from questions like this and this and the docker tutorial for ROS here I managed to stumble on to how one can "run" a docker container with GUI enabled.
It goes something like this:
$ xhost +local:docker
$ docker run -it --env="DISPLAY" --env="QT_X11_NO_MITSHM=1" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" --volume="$HOME/.Xauthority:/root/.Xauthority" ros
Afterwards, I can run inside the container in a terminal the following commands:
# roscore
And then in a separate terminal:
$ docker exec -it priceless_engelbart bash
# apt-get update
# apt-get install ros-melodic-rqt-gui
# rosrun rqt_gui rqt_gui
And a window appears, which shows that the GUI is working from inside the container.
Question: The problem is, I don't want to create a new container every time, which is what the docker run
command does. I have done work in the first container. Why would I want to completely ignore that and spin up a new container and start from scratch?
To remedy the situation, I looked into docker start, docker restart, docker attach and docker exec, to see if there was anyway to pass those extra parameters that I pass to docker run
, like --env
and --volume
to help make the GUI work inside the container here.
Unfortunately, those commands do NOT allow passing any such parameters.
I have not been able to find a solution till now for the situation.