Common Docker Commands

General Commands

docker images
docker pull
docker create
docker ps
docker attach 3378689f2069

Deleting, cleanup

docker run —rm image_name
docker system prune
docker container prune
docker network prune
docker image prune

Ubuntu Image

docker pull ubuntu
docker run -d -t ubuntu # run detached
docker run -it ubuntu /bin/bash
docker exec -it <containername> /bin/bash
apt-get update
docker compose run -it web /bin/bash

Anaconda Image

docker pull continuumio/anaconda3
docker run -it continuumio/anaconda3 /bin/bash

Set up gui:

ROS Stuff:

Modified from:

To download and install and run ros:

docker pull osrf/ros:melodic-desktop-full
docker run \--name ros-dev -it osrf/ros:melodic-desktop-full bash
echo source \"/opt/ros/melodic/setup.bash\" \>\> \~/.bashrc
source \~/.bashrc

Anytime you want to develop in ROS, simply open a Powershell window and run the command below (make sure to substitute in the container name you chose to use before:

docker exec -it ros-dev bash

Setup vcXsrv

Put in your wifi’s ip address:

echo \'export DISPLAY=\' \>\> \~/.bashrc
echo \'export DISPLAY=\' \>\> \~/.bashrc

To install a terminal-compatible text editor

apt-get update
apt-get install nano

Accessing usb devices (not working):

docker run \--name ros-dev -t -i \--privileged -v /dev:/dev osrf/ros:melodic-desktop-full bash
docker run \--name ros-dev -t -i \--privileged -v /dev/bus/usb:/dev/bus/usb osrf/ros:melodic-desktop-full bash
docker run -t -i \--privileged -v /dev:/dev ubuntu bash


docker pull jekyll/builder
docker run \--name myjekyll -v c:/users/danaukes/websites:/srv/jekyll -it jekyll/builder bash

SEe the dockerfile

from here

You cannot see the Dockerfile from Docker Hub, unless the maintainer add it. Many Docker hub repos add the GitHub link to point the Dockerfile but this is up to the maintaner.

What you can do to see the dockerfile is:

pull the Docker image with docker pull <image-name>
docker history <image-name>

From the docker history command, the first line indicates the parent docker image and in the following lines you can see all the steps used to compose the final image.

docker history --no-trunc <imagename>

Build Options

force rebuild

docker build --no-cache

see all text

docker build --progress plain