๐Ÿ“ Docker Images Cheat Sheet ๐Ÿš€

Command
Description

docker pull nginx
Pulls the latest Nginx image from Docker Hub.

docker images
Lists all Docker images on the local machine.

docker ps
Lists all running containers.

docker run -d nginx:latest
Runs an Nginx container in d…


This content originally appeared on DEV Community and was authored by Anass Assim

Command Description
docker pull nginx Pulls the latest Nginx image from Docker Hub.
docker images Lists all Docker images on the local machine.
docker ps Lists all running containers.
docker run -d nginx:latest Runs an Nginx container in detached mode using the latest version.
docker run -d -p 8080:80 nginx:latest Runs Nginx in detached mode and maps port 8080 on the host to port 80 in the container.
docker run -d -p 8080:80 -p 3000:80 nginx:latest Runs Nginx in detached mode and maps multiple ports (8080 and 3000).
docker ps -a Lists all containers (including stopped ones).
docker exec -it $ID Executes a command inside a running container (replace $ID with container ID).
docker rm $(docker ps -aq) Removes all stopped containers.
docker run --name "MyPage" -d -p 8080:80 nginx:latest Runs a container named "MyPage" with port mapping.
cd /home/user/myhtml && docker run --name "MyPage" -v $(pwd):/usr/share/nginx/html:ro -d -p 8080:80 nginx Runs a container and mounts the local HTML folder to the container.
docker exec -it $container_name bash Opens a bash shell in the running container (replace $container_name).
docker run --name "copy-of-mypage" --volumes-from "mypage" -d -p 8081:80 nginx Runs a new container using the same volumes as "mypage" and maps port 8081.


This content originally appeared on DEV Community and was authored by Anass Assim


Print Share Comment Cite Upload Translate Updates
APA

Anass Assim | Sciencx (2025-01-09T03:16:25+00:00) ๐Ÿ“ Docker Images Cheat Sheet ๐Ÿš€. Retrieved from https://www.scien.cx/2025/01/09/%f0%9f%93%9d-docker-images-cheat-sheet-%f0%9f%9a%80/

MLA
" » ๐Ÿ“ Docker Images Cheat Sheet ๐Ÿš€." Anass Assim | Sciencx - Thursday January 9, 2025, https://www.scien.cx/2025/01/09/%f0%9f%93%9d-docker-images-cheat-sheet-%f0%9f%9a%80/
HARVARD
Anass Assim | Sciencx Thursday January 9, 2025 » ๐Ÿ“ Docker Images Cheat Sheet ๐Ÿš€., viewed ,<https://www.scien.cx/2025/01/09/%f0%9f%93%9d-docker-images-cheat-sheet-%f0%9f%9a%80/>
VANCOUVER
Anass Assim | Sciencx - » ๐Ÿ“ Docker Images Cheat Sheet ๐Ÿš€. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/01/09/%f0%9f%93%9d-docker-images-cheat-sheet-%f0%9f%9a%80/
CHICAGO
" » ๐Ÿ“ Docker Images Cheat Sheet ๐Ÿš€." Anass Assim | Sciencx - Accessed . https://www.scien.cx/2025/01/09/%f0%9f%93%9d-docker-images-cheat-sheet-%f0%9f%9a%80/
IEEE
" » ๐Ÿ“ Docker Images Cheat Sheet ๐Ÿš€." Anass Assim | Sciencx [Online]. Available: https://www.scien.cx/2025/01/09/%f0%9f%93%9d-docker-images-cheat-sheet-%f0%9f%9a%80/. [Accessed: ]
rf:citation
» ๐Ÿ“ Docker Images Cheat Sheet ๐Ÿš€ | Anass Assim | Sciencx | https://www.scien.cx/2025/01/09/%f0%9f%93%9d-docker-images-cheat-sheet-%f0%9f%9a%80/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.