Docker commands

A container is an instance of an image. An image is created by running a recipe.

Install :

Check this docker hub repo:

List of useful docker commands:
# Show available docker images
docker images
# Download image
docker pull debian
# Delete image
docker image rm <IMAGE_ID>
# Show containers
docker ps -a
# Create container from image
docker run -it --name="<CONTAINER_NAME>" <IMAGE_ID>
# You can forward ports with -p <HOST_PORT>:<CONTAINER_PORT>
# You can mount folders with -v /host/dir:/container/dest
# Delete container
docker rm <CONTAINER_ID>
# Run image interactively (creates container and removes it on exit)
docker run -it --rm=true <IMAGE_ID>
# Build docker image from Dockerfile, will be accessible by name <IMAGE_NAME>
docker build -t <IMAGE_NAME> .
# Stop container
docker stop <CONTAINER_ID>
# Start existing container
docker start <CONTAINER_ID>
# List volumes
docker volume ls
# Rename container
# Add docker network
docker network create --subnet= <NETWORK_NAME>
# List docker networks
docker network list
# Delete docker network
docker network remove <NETWORK_ID>
# Run image (by starting new container) with given IP in given network
docker run --net <NETWORK_NAME> --ip -it --rm=true <IMAGE_NAME>
# Run image (by starting new container) container with given host name
docker run -it --rm=true -h <HOST_NAME> <IMAGE_NAME>
# Rename container

# Update a running container to auto-restart
docker update --restart=always <CONTAINER_ID>

# Save docker image to file:
docker save -o <PATH_TO_FILE> <IMAGE_NAME>

# Load docker image from file:
docker load -i <PATH_TO_FILE>

# This seems like a nice UI for docker:
docker run -d -p 10086:10086 -v /var/run/docker.sock:/var/run/docker.sock tobegit3hub/seagull
# Then go to

To cleanup a debian docker image you can:

# To undo apt-get update you can:
rm -Rf /var/lib/apt/lists/*