DEV Community

Anass Assim
Anass Assim

Posted on

1

πŸ“ 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 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.

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

πŸ‘‹ Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay