Nothing Special   »   [go: up one dir, main page]

Skip to content

This cheat sheet includes sections on getting started, managing images, containers, networking, volumes, Docker Compose, and Docker Swarm

Notifications You must be signed in to change notification settings

Nikoo-Asadnejad/Docker-Commands-Cheat-Sheet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Docker Command Cheat Sheet

This cheat sheet provides a quick reference for common Docker commands.

Table of Contents

Getting Started

Command Description
docker --version Display the installed Docker version
docker info Display system-wide information about Docker
docker help Display help for Docker commands

Images

Command Description
docker pull <image> Pull an image from Docker Hub
docker images List all available images
docker rmi <image> Remove an image
docker build -t <image-name>:<tag> <path> Build an image from a Dockerfile
docker tag <source-image> <target-image> Tag an image with a new name
docker search <term> Search for images on Docker Hub

Containers

Command Description
docker run <image> Run a command in a new container
docker run -d <image> Run a container in detached mode
docker ps List running containers
docker ps -a List all containers, including stopped ones
docker stop <container> Stop a running container
docker start <container> Start a stopped container
docker restart <container> Restart a container
docker rm <container> Remove a stopped container
docker exec -it <container> <command> Execute a command inside a running container
docker logs <container> Fetch the logs of a container

Networking

Command Description
docker network ls List all networks
docker network create <network-name> Create a new network
docker network rm <network-name> Remove a network
docker network inspect <network-name> Inspect a network
docker run --network <network-name> <image> Run a container in a specific network

Volumes

Command Description
docker volume ls List all volumes
docker volume create <volume-name> Create a new volume
docker volume rm <volume-name> Remove a volume
docker run -v <volume-name>:<container-path> <image> Mount a volume into a container

Docker Compose

Command Description
docker-compose up Start services defined in a docker-compose.yml file
docker-compose down Stop and remove services defined in a docker-compose.yml file
docker-compose ps List containers for the services defined in the docker-compose.yml file
docker-compose logs View logs for services defined in the docker-compose.yml file
docker-compose build Build or rebuild services defined in the docker-compose.yml file

Docker Swarm

Command Description
docker swarm init Initialize a new Swarm
docker swarm join --token <token> <manager-ip>:<port> Join a Swarm as a worker
docker service create --name <service-name> <image> Create a new service in the Swarm
docker service ls List all services in the Swarm
docker service scale <service-name>=<replica-count> Scale a service to the specified number of replicas
docker node ls List all nodes in the Swarm

About

This cheat sheet includes sections on getting started, managing images, containers, networking, volumes, Docker Compose, and Docker Swarm

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published