This is a draft cheat sheet. It is a work in progress and is not finished yet.
Installation
docker run [image] |
Downloads image and starts as container |
docker image ls |
Lists all local available images |
docker ps |
Lists all running containers |
docker ps -a |
Lists all containers |
docker search [image] |
Search for image in docker hub |
docker pull [image] |
Download image from hub |
docker inspect [container] | more |
Shows container details |
docker rm -f [container] |
Removes container |
docker rmi [image] |
Removes image |
docker run
-d |
Runs container in background (detached) |
--name [container_name] |
Runs as container_name |
docker exec -it [container] /bin/sh |
Executes shell in container |
-e "VIRTUAL_HOST=example.com" |
Environment variables |
--network [network_name] |
Starts in UDNetwork |
-v [host-src:]container-dest[:<options>] |
Mounts "host-src" as "container-dest" |
-p [host_port]:[container_port] |
Maps ports to host machine |
mount options: rw, ro, nocopy
|
|
docker volumes
docker volume ls --filter dangling=true |
Lists unused docker volumes |
docker volume prune |
Removes all unused docker volumes (!) |
docker volume create [volume_name] |
Creates new volume |
docker volume inspect [volume_name] |
Inspects volume content |
docker network
docker network inspect [network_name] |
Shows network details |
docker network create [network_name] |
Creates new network |
docker network ls |
lists all available networks |
|