🐋Day 20 - Docker Cheat Sheet

🐋Day 20 - Docker Cheat Sheet

Docker is a tool that helps developers to run their apps in isolated environments which also called containers. It's great for everyone, whether you're just starting or want one stop solution for docker commands . This cheat sheet will help you with installing Docker, managing volumes , handling images , and operating containers (like starting, stopping, and removing them).

Docker Commands

✨Container Management:

CommandDescription
docker runCreate and start a new container.
docker startStart one or more stopped containers.
docker stopStop one or more running containers.
docker restartRestart one or more containers.
docker rmRemove one or more containers.
docker psList running containers.
docker ps -aList all containers (including stopped ones).
docker logsFetch the logs of a container.

✨Image Management:

CommandDescription
docker imagesList images.
docker pullPull an image or a repository from a registry.
docker buildBuild an image from a Dockerfile.
docker pushPush an image or a repository to a registry.
docker rmiRemove one or more images.

✨Volume Management:

CommandDescription
docker volume lsList volumes.
docker volume createCreate a volume.
docker volume inspectDisplay detailed information on one or more volumes.

✨Network Management:

CommandDescription
docker network lsList networks.
docker network createCreate a network.
docker network inspectDisplay detailed information on one or more networks.
docker network rmRemove one or more networks.

Docker-Compose Commands

✨Lifecycle Management:

CommandDescription
docker-compose upBuild and start containers.
docker-compose downStop and remove containers, networks, images, and volumes.
docker-compose startStart services.
docker-compose stopStop services.
docker-compose restartRestart services.
docker-compose pausePause services.
docker-compose unpauseUnpause services.

✨Service Management:

CommandDescription
docker-compose psList containers.
docker-compose execExecute a command in a running container.
docker-compose buildBuild or rebuild services.
docker-compose logsView output from containers.
docker-compose pullPull service images.

✨Scaling:

CommandDescription
docker-compose scaleScale services to a specified number of containers.

✨Configuration:

CommandDescription
docker-compose configValidate and view the Compose file configuration.
docker-compose up -dStart services in detached mode.
docker-compose -f FILENAME.ymlSpecify an alternate compose file.

✨Interacting with Services:

CommandDescription
docker-compose exec SERVICE CMDExecute a command within a running service container.
docker-compose run SERVICE CMDRun a one-time command against a service.

Discover the power of Docker and Docker-Compose with our comprehensive cheat sheet! 🐳 Whether you're a seasoned DevOps engineer or just getting started, this handy reference guide provides a quick overview of essential commands for container management, image manipulation, volume and network configuration, and more. Simplify your Docker workflow and streamline your containerized development with this indispensable resource. Dive in and elevate your Docker skills to the next level! 🚀

Did you find this article valuable?

Support Vivek Ashok Moudekar by becoming a sponsor. Any amount is appreciated!