Docker Quick How-to

Well, I use Debian. A lot of things use Ubuntu. For the sake of laziness, I decided to use Docker to run an Ubuntu image. Originally, I installed docker to run Pokemon Go bots.

  • List running docker processes

docker ps

  • List all docker containers

docker ps -a

  • Instantiate an Ubuntu docker instance

docker run -it ubuntu:16.04 /bin/bash

  • Run docker with GUI support

docker run -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix /bin/bash

  • Restart a docker instance

docker start -a -i 9bb21badced9

  • Clear all stopped docker instances

docker rm `docker ps –no-trunc -aq`

Please note that you cannot run xterm as root.

docker run -it --env="DISPLAY" --env="QT_X11_NO_MITSHM=1" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" ubuntu:16.04 /bin/bash
docker run -it --env="DISPLAY" --env="QT_X11_NO_MITSHM=1" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" --device /dev/nvidia0:/dev/nvidia0 --device /dev/nvidiactl:/dev/nvidiactl --device /dev/nvidia-uvm:/dev/nvidia-uvm ubuntu:16.04 /bin/bash
  • public/docker_quick_how-to.txt
  • Last modified: 2018/03/31 01:38
  • (external edit)