Dionysen

Docker common commands

Image Management

docker images   # Show images
docker rmi # Delete images
docker build # Build image with Dockerfile

Container Management

docker run       # Create container  
docker start # Start container
docker stop # Stop container
docker restart # Restart container
docker rm # Remove container

Container Operator

docker ps     # Show container status
docker exec # Execuate command in the container
docker logs # Show container logs

Other Commands

docker tag ubuntu:22.04 myregistry.com/my-ubuntu:v1.0  # Tag image

docker save -o my_ubuntu_image.tar ubuntu:22.04 # Save image to a tar file
docker save ubuntu:22.04 | gzip > my_ubuntu_image.tar.gz # Use gzip

docker load -i my_ubuntu_image.tar # Load image from file
gunzip -c my_ubuntu_image.tar.gz | docker load # If save image using gzip
显示评论