Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Just some basic docker commands:

Table of Contents
minLevel3

Guide

Manage images

List images

Code Block
docker image ls

Remove images

Remove all dangling images (e.

...

g. those that are not tagged or referenced by a container):

Code Block
docker image prune

Remove all images not use by an existing container:

Code Block
docker image prune -a

Manage containers

List containers

...

Code Block
docker <start|stop|restart> <container>

Remove container

Code Block
docker rm <container>

The below will stop and remove (delete) a container

Code Block
docker rm -f <container>

List container port mappings 

...

Code Block
docker cp <container>:/file/path/within/container /host/path/target

Interactively log into container with bash

Code Block
languagebash
docker exec -it <container> /bin/bash

Cleaning

Warning

This will delete all stopped containers, all networks not used, all dangling images, and all build cache:


Code Block
docker system prune

References

  1. https://docs.docker.com/
  2. https://stackoverflow.com/questions/22049212/copying-files-from-docker-container-to-host

...