Process Management
Commands | Use Cases |
docker --version | Check Docker version. |
docker info | Display system-wide information about Docker. |
docker ps | Show all running Docker containers. |
docker ps -a | Show all Docker containers. |
docker run <image>:<tag> | Run a containers. |
docker run -it <image>:<tag> | Run a container and connect to it. |
docker run -d <image>:<tag> | Run a container in the background. |
docker stop <CONTAINER_ID> | Stop a container. |
docker kill <CONTAINER_ID> | Kill a containers. |
docker rm <CONTAINER_ID> | Remove a containers. |
Volumes & Ports
Commands | Use Case |
docker volume ls | Lists of volumes. |
docker volume create <volume> | Create a volume. |
docker volume rm <volume> | Delete a volume. |
docker volume inspect <volume> | Show volumes metadata. |
docker volume prune | Delete all volumes not attached to a container. |
docker volume -v <local_dir>:<container_dir> <image> | Mount a local directory into your container. |
docker cp <container>:<container_dir> <local_dir> | Copy file or folder from a docker container to host machine. |
docker cp <local_dir> <container>:<container_dir> | Copy file or folder from local machine onto a container. |
docker run -d -p <ip address>:<local port>:<docker port> <image> | Map a local port to docker instance. |
docker port <CONTAINER_ID> | Lists the ports a docker container is running on. |
Docker compose
Commands | Use Cases |
docker-compose up -d -d <docker-compose_yaml> | Start your docker-compose defined resource in detached mode. |
docker-compose stop | Stop all docker-compose resource. |
docker-compose down | Destroy all docker-compose resource. |
docker-compose ps | Show Docker-compose processes. |
docker-compose logs | Show Docker-compose logs. |
docker-compose top | Show Docker-compose resource consumption. |
Images/Repository
Commands | Use Cases |
docker images | List available local images. |
docker search <image> | Search for Docker images. |
docker pull <image_name> | Pull a Docker images. |
docker build -t <image>:<tag> <run_directory> -f <dockerfile> | Build an image with a Docker file. |
docker login <repository> | Login to remote repository. |
docker push <image>:<tag> | Push an image to your remote repository. |
docker rmi <image>:<tag> | Remove a local Docker image. |
docker inspect <image> | Show metadata for an image. |
docker image prune | Remove all unused Docker images. |
Troubleshooting
Commands | Use Cases |
docker logs <container> | Show the logs of container. |
docker logs -f <container> | Follow/tail the logs of the container. |
docker logs -t <container> | Show timestamps on docker logs. |
docker top <container> | Show a 'top' view of processes running on a container. |
docker stats | Show a top view of all docker containers. |
docker diff <container> | Show any files that have changed since startup. |
docker attach <container> | Connect to an already running container. |
docker exec -it <Container_id> /bin/bash | Execute a command on a container. |
docker system info | Show Docker system wide information. |
docker system df | Show Docker Disk spaced used. |
Networks
Commands | Use Cases |
docker network create <network_name> | Create a User define network. |
docker network ls | List networks. |
docker network connect <network_name> <container_name/id> | Connect a Container to a network. |
docker network disconnect <network_name> <container_name/id> | Disconnect a container from a network. |
Happy Learning
Thanks For Reading! :)
-SriParthu๐๐ฅ
ย