50 Essential Docker Commands for Developers
Command | Description |
---|---|
docker run | Creates and starts a new container from an image. |
docker ps | Lists running containers. Use `docker ps -a` for all. |
docker stop | Stops a running container. |
docker start | Starts a stopped container. |
docker restart | Restarts a container. |
docker kill | Forcefully stops a container. Use with caution. |
docker rm | Removes a stopped container. |
docker rmi | Removes an image. Remove dependent containers first. |
docker images | Lists available images. |
docker build | Builds an image from a Dockerfile. |
docker pull | Downloads an image from a registry. |
docker push | Uploads an image to a registry. |
docker exec | Executes a command inside a container (e.g., `bash`). |
docker logs | Displays container logs. |
docker cp | Copies files between container and host. |
docker inspect | Displays detailed information about a container/image. |
docker port | Shows port mappings for a container. |
docker stats | Displays container resource usage statistics. |
docker compose up | Starts services defined in a `docker-compose.yml` file. |
docker compose down | Stops services defined in a `docker-compose.yml` file. |
docker compose ps | Lists containers created by Docker Compose. |
docker compose exec | Executes a command in a running Compose container. |
docker compose logs | Views logs from Compose services. |
docker compose build | Builds or rebuilds services defined in `docker-compose.yml`. |
docker network create | Creates a Docker network. |
docker network connect | Connects a container to a network. |
docker network disconnect | Disconnects a container from a network. |
docker network ls | Lists Docker networks. |
docker volume create | Creates a Docker volume. |
docker volume ls | Lists Docker volumes. |
docker volume rm | Removes a Docker volume. |
docker volume inspect | Displays information about a volume. |
docker login | Logs in to a Docker registry. |
docker logout | Logs out from a Docker registry. |
docker search | Searches for images on Docker Hub. |
docker info | Displays system-wide Docker information. |
docker version | Displays Docker version information. |
docker attach | Attaches to a running container. |
docker commit | Creates a new image from a container's changes. |
docker diff | Shows changes to files in a container's filesystem. |
docker events | Gets real time events from the docker server. |
docker history | Shows the history of a Docker image. |
docker import | Imports a tarball as a Docker image. |
docker load | Loads an image from a tar archive. |
docker save | Saves one or more images to a tar archive. |
docker tag | Creates a tag for an image. |
docker wait | Blocks until a container stops, then prints its exit code. |
docker update | Updates configuration of one or more containers. |
docker system prune | Removes unused data. |
docker context ls | Lists the Docker contexts. |
docker context use | Sets the current Docker context. |
Comments
Post a Comment