User Tools

Site Tools


public:docker_quick_how-to

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.

Basic commands

  • 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`

Run Docker with GUI support

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

Running Docker with GPU support

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 00:38 by 127.0.0.1