List of commands used for Docker
In Docker, you can use various types of commands to interact with the Docker engine and manage containers, images, networks, and volumes. Here are the main types of commands used in Docker:
Management Commands: These commands are used to manage Docker resources like containers, images, networks, and volumes. Examples include
docker run
,docker stop
,docker rm
,docker images
,docker network
, anddocker volume
. These commands allow you to create, start, stop, remove, and inspect Docker resources.Build Commands: These commands are used to build Docker images from Dockerfiles or other build contexts. The primary build command is
docker build
, which allows you to specify the build context and Dockerfile to create an image. Additional build-related commands includedocker commit
(creates an image from a container) anddocker tag
(adds tags to an image).Registry Commands: These commands are used to interact with Docker registries, which store Docker images. The main registry commands are
docker pull
(downloads an image from a registry),docker push
(uploads an image to a registry), anddocker search
(searches for images in a registry).Execution Commands: These commands are used to execute commands within a running Docker container. The primary execution command is
docker exec
, which allows you to run a command in a running container. You can also usedocker attach
to attach to a running container's input/output, ordocker run
with the--entrypoint
option to override the default entrypoint.Information Commands: These commands provide information about Docker resources and configurations. Examples include
docker info
(displays Docker system information),docker version
(displays Docker version information), anddocker inspect
(provides detailed information about Docker objects like containers, images, networks, and volumes).
These are the main types of commands used in Docker. By combining these commands and their options, you can effectively manage and work with Docker containers and images.
Here's a list of commonly used commands for Docker:
Management Commands:
docker run
: Create and start a new container from an image.docker stop
: Stop a running container.docker start
: Start a stopped container.docker restart
: Restart a running container.docker rm
: Remove one or more containers.docker rmi
: Remove one or more images.docker ps
: List running containers.docker images
: List downloaded images.docker inspect
: Display detailed information about a container, image, network, or volume.docker logs
: Fetch the logs of a container.docker exec
: Run a command in a running container.docker cp
: Copy files/folders between a container and the local filesystem.
Build Commands:
docker build
: Build a Docker image from a Dockerfile.docker commit
: Create an image from a container's changes.docker tag
: Add a tag to an image.
Registry Commands:
docker pull
: Download an image or a repository from a registry.docker push
: Upload an image or a repository to a registry.docker search
: Search for images in a registry.
Network Commands:
docker network create
: Create a network.docker network ls
: List networks.docker network inspect
: Display detailed information about a network.
Volume Commands:
docker volume create
: Create a volume.docker volume ls
: List volumes.docker volume inspect
: Display detailed information about a volume.
System Commands:
docker info
: Display system-wide information about Docker.docker version
: Show Docker version information.docker system prune
: Remove unused resources such as stopped containers, unused networks, and dangling images.
These commands cover the essential operations for managing Docker containers, images, networks, volumes, and the Docker system itself. Keep in mind that there are many more commands available with additional options and functionalities. You can explore further by referring to the Docker documentation for a comprehensive list of commands and their usage.