Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
7 views3 pages

Docker Cheat Sheet For Beginners

This Docker Cheat Sheet provides essential commands for managing Docker, including checking versions, handling images, containers, volumes, and networks. It also covers Docker Compose commands for managing multi-container applications and outlines basic Dockerfile instructions for building images. The document serves as a quick reference for Docker users to streamline their workflow.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views3 pages

Docker Cheat Sheet For Beginners

This Docker Cheat Sheet provides essential commands for managing Docker, including checking versions, handling images, containers, volumes, and networks. It also covers Docker Compose commands for managing multi-container applications and outlines basic Dockerfile instructions for building images. The document serves as a quick reference for Docker users to streamline their workflow.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Docker Cheat Sheet

Basics
Check Docker version:
docker --version

Start Docker daemon (Linux):


sudo systemctl start docker

Check if Docker is running:


docker info

Images
List images:
docker images

Pull image:
docker pull <image_name>

Remove image:
docker rmi <image_name>

Build image from Dockerfile:


docker build -t <name> .

Containers
List running containers:
docker ps

List all containers:


docker ps -a

Run container:
docker run <image_name>

Run with name and detached:


docker run -d --name <name> <image_name>

Run with port mapping:


docker run -p host:container <image_name>

Stop container:
docker stop <container_id/name>

Start container:
Docker Cheat Sheet

docker start <container_id/name>

Remove container:
docker rm <container_id/name>

Volumes & Networks


List volumes:
docker volume ls

Create volume:
docker volume create <volume_name>

Mount volume:
docker run -v <volume_name>:/path <image_name>

List networks:
docker network ls

Create network:
docker network create <network_name>

Docker Compose
Start services:
docker-compose up

Start in detached mode:


docker-compose up -d

Stop services:
docker-compose down

Rebuild services:
docker-compose up --build

Dockerfile Instructions
FROM:
Base image

RUN:
Execute command

COPY:
Docker Cheat Sheet

Copy files from host to container

ADD:
Similar to COPY but supports URLs and unpacking

CMD:
Default command

ENTRYPOINT:
Configures container to run as executable

WORKDIR:
Set working directory

EXPOSE:
Expose port

You might also like