Changelog

Docker Command Quick Reference

DockerεΈΈη”¨ε‘½δ»€ι€ŸζŸ₯θ‘¨οΌŒεΏ«ι€ŸζŸ₯ζ‰Ύε’Œε€εˆΆ Docker 命什

Container Management
35
docker run [OPTIONS] IMAGE

Create and start a new container

docker run -d IMAGE

Run container in background

docker run --name NAME IMAGE

Run container with specified name

docker run -p HOST:CONTAINER IMAGE

Run container with port mapping

docker run -v HOST:CONTAINER IMAGE

Run container with volume mounting

docker run -e KEY=VALUE IMAGE

Run container with environment variables

docker run --rm IMAGE

Automatically remove container after exit

docker run -it IMAGE /bin/bash

Run container interactively

docker ps

List running containers

docker ps -a

List all containers (including stopped)

docker ps -q

Show only container IDs

docker start CONTAINER

Start a stopped container

docker stop CONTAINER

Stop a running container

docker restart CONTAINER

Restart container

docker kill CONTAINER

Force stop container

docker rm CONTAINER

Remove stopped container

docker rm -f CONTAINER

Force remove container (including running)

docker rm $(docker ps -aq)

Remove all stopped containers

docker exec -it CONTAINER COMMAND

Execute a command inside a running container

docker exec -it CONTAINER /bin/bash

Enter the bash terminal of the container

docker logs CONTAINER

View container logs

docker logs -f CONTAINER

Real-time tracking of container logs

docker logs --tail 100 CONTAINER

View the last 100 log lines

docker inspect CONTAINER

View container details

docker top CONTAINER

View processes running inside the container

docker stats

Display container resource usage in real time

docker cp CONTAINER:SRC DEST

Copy files from container to host

docker cp SRC CONTAINER:DEST

Copy files from host to container

docker rename OLD NEW

Rename container

docker pause CONTAINER

Pause container

docker unpause CONTAINER

Resume paused container

docker wait CONTAINER

Wait for container to stop and return exit code

docker attach CONTAINER

Attach to a running container

docker port CONTAINER

View container port mapping

docker update --restart=always CONTAINER

Update container configuration

Image Management
19
docker images

List local images

docker images -a

List all images (including intermediate layers)

docker pull IMAGE

Pull image from repository

docker pull IMAGE:TAG

Pull image with specified tag

docker push IMAGE

Push image to repository

docker rmi IMAGE

Remove image

docker rmi -f IMAGE

Force remove image

docker rmi $(docker images -f dangling=true -q)

Delete all dangling images

docker tag SOURCE TARGET

Create a new tag for an image

docker history IMAGE

View image build history

docker inspect IMAGE

View image details

docker save -o FILE.tar IMAGE

Save image as a tar file

docker load -i FILE.tar

Load image from a tar file

docker import FILE.tar IMAGE

Import image from a tar file

docker export CONTAINER > FILE.tar

Export container as a tar file

docker commit CONTAINER IMAGE

Create a new image from a container

docker search TERM

Search for images on Docker Hub

docker image prune

Remove unused images

docker image prune -a

Remove all unused images

Data Volumes
7
docker volume ls

List all volumes

docker volume create NAME

Create a volume

docker volume inspect NAME

View volume details

docker volume rm NAME

Remove volume

docker volume prune

Remove all unused volumes

docker run --rm -v NAME:/data -v $(pwd):/backup alpine tar cvf /backup/backup.tar /data

Backup volume

docker run --rm -v NAME:/data -v $(pwd):/backup alpine tar xvf /backup/backup.tar -C /

Restore volume

Network Management
9
docker network ls

List all networks

docker network create NAME

Create network

docker network create --driver bridge NAME

Create bridge network

docker network create --driver overlay NAME

Create overlay network

docker network inspect NAME

View network details

docker network rm NAME

Remove network

docker network connect NETWORK CONTAINER

Connect container to network

docker network disconnect NETWORK CONTAINER

Disconnect container from network

docker network prune

Remove all unused networks

Docker Compose
17
docker compose up

Create and start all services

docker compose up -d

Start all services in background

docker compose up --build

Build images and start services

docker compose down

Stop and remove all services

docker compose down -v

Stop services and remove data volumes

docker compose start

Start existing services

docker compose stop

Stop services

docker compose restart

Restart services

docker compose ps

List service statuses

docker compose logs

View service logs

docker compose logs -f

Follow service logs in real time

docker compose exec SERVICE COMMAND

Execute command in service container

docker compose build

Build service images

docker compose pull

Pull service images

docker compose config

Validate and view configuration

docker compose run SERVICE COMMAND

Run one-off command

docker compose up --scale SERVICE=NUM

Scale service instance count

System Management
8
docker info

Display Docker system information

docker version

Display Docker version information

docker system df

Display Docker disk usage

docker system prune

Clean up unused data

docker system prune -a

Clean up all unused data

docker system prune --volumes

Clean up unused data including data volumes

docker events

Get Docker events in real time

docker events --filter 'type=container'

Filter events of specific types

Image Registry
4
docker login

Log in to Docker Hub

docker login SERVER

Log in to a specified image repository

docker logout

Log out of Docker Hub

docker logout SERVER

Log out of a specified image repository

Image Build
7
docker build -t NAME .

Build an image from a Dockerfile

docker build -f Dockerfile.dev -t NAME .

Specify Dockerfile for build

docker build --no-cache -t NAME .

Build without using cache

docker build --build-arg KEY=VALUE -t NAME .

Pass build arguments

docker build --target STAGE -t NAME .

Build a specific stage in multi-stage builds

docker buildx build --platform linux/amd64,linux/arm64 -t NAME .

Multi-platform build

docker buildx create --use

Create and use a new builder

πŸ“–Tool Introduction

Docker Command Quick Reference is a fast-reference tool designed for developers and operations personnel. It covers all common Docker commands, including container management, image operations, data volumes, network configuration, and Docker Compose, organized by functionality, supporting quick search and one-click copy. Whether you are a Docker beginner or an experienced DevOps engineer, you can quickly find the commands you need here.

Key Features

1
8 major categories covering all common Docker scenarios
2
Over 100 common commands, comprehensively covering from basic to advanced
3
Supports keyword search to quickly locate required commands
4
One-click copy of commands to improve work efficiency
5
Clear Chinese explanations for easy understanding and learning
6
Browse and filter by categories to quickly find relevant commands
7
Responsive design supporting mobile viewing
8
Runs locally, no internet required

❓Frequently Asked Questions

πŸ”—Related Tools

Cron Expression Parser

Validate cron syntax and preview upcoming schedules.

Developer Tools
Try Now

JSON to CSV

Convert JSON data to CSV format

Converters
Try Now

JSON to YAML

Convert JSON data to YAML format

Converters
Try Now

JSON to XML

Convert JSON data to XML format

Converters
Try Now

YAML to JSON

Convert YAML configuration to JSON data

Converters
Try Now

JSON Formatter

Format, validate and minify JSON data

JSON Utilities
Try Now

JSON Visualizer

Display JSON data in tree structure

JSON Utilities
Try Now

JSON Data Generator

Generate mock JSON data for testing

JSON Utilities
Try Now

i18n JSON Translator

Translate entire JSON locale files in one go. Paste your base content, choose target languages, and the tool will call your OpenRouter-powered API with flattened keys.

JSON Utilities
Try Now

JSON Diff Comparison

Compare differences between two JSON data

JSON Utilities
Try Now

QR Code Generator

Generate custom QR code images

Image Tools
Try Now

SVG Placeholder Generator

Generate custom SVG placeholder images

Image Tools
Try Now

Base64 Image Converter

Convert images to Base64 encoding and vice versa

Image Tools
Try Now

UUID Generator

Generate UUID unique identifiers in batch

Generator Tools
Try Now

Password Generator

Generate secure and reliable random passwords

Generator Tools
Try Now

Base64 Encoder/Decoder

Base64 string encoding and decoding tool

Text Tools
Try Now

URL Encoder/Decoder

URL string encoding and decoding tool

Text Tools
Try Now

MD5 Hash Generator

Generate MD5 hash values from text

Crypto Tools
Try Now

SHA256 Hash Generator

Generate SHA256 hash values from text

Crypto Tools
Try Now

SHA1 Hash Generator

Generate SHA1 hash values from text

Crypto Tools
Try Now

Hex Encoder/Decoder

Hexadecimal string encoding and decoding tool

Crypto Tools
Try Now

Binary Encoder/Decoder

Binary string encoding and decoding tool

Crypto Tools
Try Now

AES Encrypt/Decrypt

AES symmetric encryption algorithm tool

Crypto Tools
Try Now

RSA Encrypt/Decrypt

RSA asymmetric encryption algorithm tool

Crypto Tools
Try Now

HMAC Generator

HMAC message authentication code generation tool

Crypto Tools
Try Now

IP Address Lookup

Query geographical location and network information of IP addresses

Network Tools
Try Now

Milliseconds Time Converter

Convert between millisecond timestamps and formatted date strings.

Time Tools
Try Now
Showing 27 of 28 tools
    Docker Command Quick Reference - Quick Reference for Common Commands - IT Tools Collection