Docker resources for learning and practicing.
Docker
# List running containers
docker ps
# List all containers
docker ps -a
# Start stopped containers
docker start container_id/container_name
# Stop one or more running containers
docker stop container_id/container_name
# Attach local standard input, output, and error streams to a running container
docker attach container_id/container_name
# Remove one or more containers
docker rm container_id/container_name
# Fetch the logs of a container
docker logs container_id/container_name
# Return low-level information on Docker objects
docker inspect container_id/container_name
# Restart one or more containers
docker restart container_name/container_id
# Remove unused data
docker system prune
# Log in to a Docker registry
docker login
# Tag an image
docker tag mycurl username/repository_name:version
# Upload an image to a registry
docker push username/repository_name:version
Docker Container
# List containers
docker container ls
# Remove all stopped containers
docker container prune
# Stop one or more running containers
docker container stop CONTAINER
Docker Image
# List images
docker image ls
# Display detailed information on one or more images
docker image inspect repository_name:tag/image_id
# Show the history of an image
docker image history repository_name:tag/image_id
# Pull an image or a repository from a registry
docker image pull repository_name:tag/image_id
# Remove one or more images
docker image rm repository_name:tag/image_id
# Remove unused images
docker image prune
Docker Compose
# Check version
docker compose version
# Logs from each of the services interleaved into a single stream
docker compose logs -f
# Logs from specific services
docker compose logs -f app
# Build or rebuild services
docker compose build
# Create and start containers
docker compose up
# Options
docker compose up -d
docker compose up --build
docker compose up container_name/container_id
# Stop services
docker compose stop
# Removes stopped service containers
docker compose rm
# Stop and remove containers, networks
docker compose down
Docker Volume
# List volumes
docker volume ls
# Remove one or more volumes
docker volume rm volume_name
# Create a volume
docker volume create --name volume_name
Docker network
# List networks
docker network ls
# Remove all unused networks
docker network prune
# Display detailed information on one or more networks
docker inspect container_name/container_id
# Create a network
docker network create network_name
- Getting Started
- What next
- The Docker Handbook – Learn Docker for Beginners
- Reference documentation
- A PHP development environment generator built with Docker containers.
- Introduction to Containers
Distributed under the MIT License. See LICENSE for more information.