grouped by category:
Docker Images
docker images
- List all images on your machinedocker pull <image>
- Pull an image from a registrydocker build -t <image> .
- Build an image from a Dockerfiledocker tag <source_image> <target_image>
- Assign a new name to an imagedocker rmi <image>
- Remove an image from your machine
Docker Containers
docker ps
- List all running containersdocker ps -a
- List all containers (running and stopped)docker run -d -p <host_port>:<container_port> --name <name> <image>
- Run a container from an image in detached mode with a name and a port mappingdocker start <name|id>
- Start a stopped containerdocker stop <name|id>
- Stop a running containerdocker restart <name|id>
- Restart a containerdocker rm <name|id>
- Remove a container from your machinedocker exec -it <name|id> <command>
- Execute a command inside a running containerdocker logs <name|id>
- View the logs of a container
Docker Volumes
docker volume ls
- List all volumes on your machinedocker volume create <name>
- Create a volume with a namedocker volume inspect <name>
- View the details of a volumedocker volume rm <name>
- Remove a volume from your machine
Docker Networks
docker network ls
- List all networks on your machinedocker network create --driver <driver> <name>
- Create a network with a name and a driverdocker network inspect <name>
- View the details of a networkdocker network rm <name>
- Remove a network from your machine
Docker Compose
docker-compose up
- Build and run containers defined in a docker-compose.yml filedocker-compose up -d
- Run containers in detached modedocker-compose down
- Stop and remove containers and networks created by updocker-compose ps
- List containers managed by composedocker-compose logs
- View the logs of containers