Introduction to Docker
Demo Files
Docker CLI
Remove all unused containers, networks, images (both dangling and unused), and optionally, volumes.
| docker system prune -a -f
|
Docker Build
The docker build command builds Docker images from a Dockerfile and a "context"
| docker build -t tejasparikh/node-app .
docker build -t tejasparikh/node-app -f Dockerfile.app .
docker build -t tejasparikh/node-app --no-cache -f Dockerfile.app .
|
Docker Run
The docker run command runs a command in a new container, pulling the image if needed and starting the container.
| docker run tejasparikh/node-app:latest
docker run -p 8080:8080 tejasparikh/node-app:latest
docker run -d -p 8080:8080 tejasparikh/node-app
docker run -d -p 10080:8080 tejasparikh/node-app
docker run -p 8080:8080 tejasparikh/node-app:latest
|
Docker Logs
The docker logs command batch-retrieves logs present at the time of execution.
| docker logs <ID>
docker logs -f <ID>
|
Docker Shell
The docker exec command runs a new command in a running container.
| docker exec -it <ID> /bin/bash
|
Docker Stats
The docker stats command returns a live data stream for running containers.
Docker Inspect
Docker inspect provides detailed information on constructs controlled by Docker.
Docker Pull
Download an image from a registry
| docker pull debian
docker pull centos:7
|
Docker Login
Log in to a registry
Limit CPU & Memory
Runtime options with Memory, CPUs, and GPUs
| docker run --cpus=".1" -m="8m"
|
b
, k
, m
, g
indicate bytes, kilobytes, megabytes, or gigabytes.
Create a new builder instance
| docker buildx create --use
docker buildx ls
docker buildx build --platform=linux/amd64,linux/arm64 -f Dockerfile.app --no-cache -t tejasparikh/node-app:latest -t tejasparikh/node-app:0.0.2 .
|