# # Day20 : DOCKER CHEAT-SHEET

Hello , Everyone, This is my 20 blog started my day20 as AWS DevOps Engineer #90daysofchallenge with ShubhamLondhe #devops #trainwithshubham.

Docker and Docker-Compose cheat-sheet

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707752853635/555372a7-9dab-4578-a245-42439624f018.png align="center")

Docker :

Docker is a software platform that allows you to build, test, and deploy applications quickly. Docker packages software into standardized units called containers that have everything the software needs to run including libraries, system tools, code, and runtime. Using Docker, you can quickly deploy and scale applications into any environment and know your code will run.

1\. **docker run:** Create and run a new container based on an image.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707753621234/c613be69-ac56-41a7-a105-5dca52016809.png align="center")

2\. **docker ps:** List running containers.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707753763652/986e5288-ef68-4f41-964c-5e1e365d103a.png align="center")

3\. **docker build:** Build an image from a Dockerfile.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707753808240/12bf3eca-5f0c-4c5c-950b-e90291574f5b.png align="center")

4\. **docker pull:** Download an image from a registery

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707755085070/89de128d-1cb5-47e9-bcd1-cce81fd50178.png align="center")

**5.docker start:** Start a stopped container.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707755157396/55d3922d-a930-4757-adaa-4341d9940a18.png align="center")

7\. **docker stop:** Stop a running container.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707755213640/34ff3b66-838d-4909-afa4-70bd168ba8b2.png align="center")

8\. **docker restart:** Restart a running container

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707755257244/35c6c096-7622-4300-acd1-17881414c0f0.png align="center")

9\. **docker rm:** Remove a stopped container

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707755304021/db85e202-d232-4d23-8566-d398c83bf9b4.png align="center")

10\. **docker rmi:** Remove an image

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707755348364/bc2277a8-11e1-419e-8d7c-422e74b5db36.png align="center")

11\. **docker logs:** Fetch the logs of a container

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707755386815/2dbc3dbf-d76b-44ce-bf05-651e3d458eab.png align="center")

**12.docker inspect:** View detailed information about a container or image.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707755483203/13551899-c62c-4a80-968f-dd9f6850704c.png align="center")

**13.docker network ls:** List Docker networks.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707755544120/1944caef-4122-48a3-a311-10eb0a35d26b.png align="center")

**14.docker network create:** Create a Docker network

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707755594989/8c3c5780-61e2-42cf-988e-627c4ccd0292.png align="center")

**15.docker network disconnect:** Disconnect a container from a network

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707755634880/4acfac78-97ab-43d6-a151-324b59ebde5f.png align="center")

**Docker-Compose :**  
Docker Compose is a tool for defining and running multi-container applications. It is the key to unlocking a streamlined and efficient development and deployment experience.

Compose simplifies the control of your entire application stack, making it easy to manage services, networks, and volumes in a single, comprehensible YAML configuration file. Then, with a single command, you create and start all the services from your configuration file.

**Docker-Compose Commands:**

1.docker-compose down: Stop and remove containers, networks, and volumes defined in the docker-compose.yml file

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707755888904/eafd5ced-b276-4545-8322-67119086f5b4.png align="center")

2.docker-compose build: Build or rebuild services defined in the docker-compose.yml file.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707755939692/8924e402-7c98-4f05-a34c-07d633a94c3e.png align="center")

3.docker-compose start: Start services defined in the docker-compose.yml file.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707756007403/ad496a3d-5b4e-47c5-9e0f-8819a42ea8da.png align="center")

4.docker-compose stop: Stop services defined in the docker-compose.yml file

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707756076008/6c58a224-ef5d-4272-a531-30f3e18e250a.png align="center")

5\. docker-compose restart: Restart services defined in the docker-compose.yml file

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707756129270/10a724a6-df6e-4e6c-ae64-a780c3117768.png align="center")

6.docker-compose ps: List containers of services defined in the docker-compose.yml file.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707756180524/6847a464-ccf6-4a5d-a03c-4840b37660ef.png align="center")

7.docker-compose logs: Fetch the logs of services defined in the docker-compose.yml file.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707756240012/173e59f0-1705-44a2-a3a7-e170eb383e2f.png align="center")

8.docker-compose pull: Download updated images for services defined in the docker-compose.yml file.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707756297145/efe9b00c-ffbd-40de-a91d-97f853fd2191.png align="center")
