Let's follow together the Docker kata.
Here, the docker cheat sheet with popular commands.
Let's follow together the Docker kata.
Here, the docker cheat sheet with popular commands.
# Create a container from an image | |
docker run --name my-container ubuntu:20.04 | |
# Create and start a container that will remove itself after execution | |
docker run --rm --name my-container ubuntu:20.04 | |
# Create and start a container in interactive mode | |
docker run -it --name my-container ubuntu:20.04 | |
# Create and start a container in interactive mode that will remove itself after execution | |
docker run --rm -it --name my-container ubuntu:20.04 | |
# Create and start a container in detached mode | |
docker run -d --name my-container ubuntu:20.04 | |
# Execute a command in a container | |
docker exec my-container ls | |
# Execute a command in interactive mode in a container | |
docker exec -it my-container bash | |
# List running containers | |
docker ps | |
# List all containers | |
docker ps -a | |
# Stop a container | |
docker stop my-container | |
# Start a container | |
docker start my-container | |
# Remove a container | |
docker rm my-container | |
# Remove all unused containers | |
docker container prune |
# Download an image from Docker Hub | |
docker pull ubuntu:20.04 | |
# Build an image from a Dockerfile | |
docker build -t my-image . | |
# List downloaded images | |
docker images | |
# Remove an image | |
docker images rm ubuntu:20.04 | |
# Remove all unused images | |
docker image prune |