Docker Command Reference
Container Lifecycle Management
- run - Create and start a new container.
- start/stop/restart - These commands are used to start, stop, and restart containers.
- kill - Immediately terminate one or more running containers
- rm - Remove one or more stopped containers.
- pause/unpause - Pause and resume all processes in a container.
- create - Create a new container without starting it.
- exec - Execute a new command inside a running container.
- rename - Rename a container.
Container Operations
- ps - List Docker containers
- inspect - Get detailed information about Docker objects (containers, images, volumes, networks, and so on).
- top - Display the running processes inside a specified container.
- attach - Allow the user to attach to a running container and interact with it.
- events - Get events generated by the Docker daemon.
- logs - Get and view the log output of a container.
- wait - Allow the user to wait for a container to stop and get its exit code.
- export - Export a container's filesystem as a tar archive.
- port - Display the port mapping information of a container.
- stats - Display real-time resource usage of Docker containers.
- update - Update the resource limits of a Docker container, including memory, CPU, and so on.
Container Root Filesystem (rootfs) Commands
- commit - Allow the user to save the current state of a container as a new Docker image.
- cp - Copy files or directories between a container and the host.
- diff - Show changes to a Docker container's filesystem.
Image Repository
- login/logout - Manage authentication between the Docker client and a Docker registry.
- pull - Pull (download) an image from a Docker registry (such as Docker Hub) to the local machine.
- push - Push (upload) a locally built Docker image to a Docker registry (such as Docker Hub or a private registry).
- search - Search for images on Docker Hub or other registries.
Local Image Management
- images - List local Docker images.
- rmi - Remove images that are no longer needed.
- tag - Create an alias (tag) for a local image.
- build - Build a Docker image from a Dockerfile.
- history - View the history layers of a specified image.
- save - Save one or more Docker images to a tar archive.
- load - Load Docker images from a tar file generated by the docker save command.
- import - Import a container snapshot from a tar file or URL to create a new Docker image.
info|version
- info - Display system-wide information about Docker, including the current numbers of images and containers.
- version - Display version information for the Docker client and server.
Docker Compose
- docker compose run - Start a new container and run a specific application.
- docker compose rm - Start a new container and remove a specific application.
- docker compose ps - Check the status of Docker containers from docker compose.
- docker compose build - Build from a docker compose file.
- docker compose up - Run a docker compose file.
- docker compose ls - List docker compose services.
- docker compose start - Start containers created by a docker compose file.
- docker compose restart - Restart containers created by a docker compose file.
- docker compose down - Remove containers and networks associated with services.
Network Commands
docker network ls: List all networks.docker network create: Create a new network.docker network rm: Remove a specified network.docker network connect: Connect a container to a network.docker network disconnect: Disconnect a container from a network.
For details, see:docker network Command
Volume Commands
docker volume ls: List all volumes.docker volume create: Create a new volume.docker volume rm: Remove a specified volume.docker volume inspect: Display detailed information about a volume.
For details, see:docker volume Command