🐋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! 🚀

0
Subscribe to my newsletter

Read articles from Vivek Ashok Moudekar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Vivek Ashok Moudekar
Vivek Ashok Moudekar

👋 Hello there! I'm Vivek, a DevOps enthusiast with a keen interest in streamlining software delivery. I hold a Master's degree in Computer Applications and have a solid foundation in key technologies such as Linux, Git, Docker, Kubernetes, and AWS. 💻 My passion lies in automation, ensuring efficient and seamless processes throughout the software development lifecycle. I thrive on creating robust CI/CD pipelines that empower teams to deliver high-quality software with confidence. 🚀 Beyond the code, I enjoy the ever-evolving world of DevOps and the challenges it brings. Join me on this journey as I explore new ways to enhance software delivery and foster a culture of continuous improvement. Let's connect, collaborate, and make the world of DevOps even more exciting together