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
There are no updates yet.
Click the Upload button above to add an update.

APA
MLA
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/
" » ๐ 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/
HARVARDAnass 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/>
VANCOUVERAnass 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.