Docker
Image Management
Pull, list, tag, push, and prune images.
By EZ4Code Team
imageregistrymaintenance
Code
# Pull and list images
docker pull postgres:16-alpine
docker images
# Tag and push to a registry
docker tag myapp:1.0 registry.example.com/myapp:1.0
docker push registry.example.com/myapp:1.0
# Inspect and history
docker inspect postgres:16-alpine
docker history myapp:1.0
# Remove unused images
docker image prune -a
docker rmi myapp:1.0Explanation
Images are read-only templates composed of layers stacked on top of a base. docker tag creates an alias for an image, enabling push to a custom registry. image prune -a removes all unused images to reclaim disk space.
More Docker Snippets
Run a Container
Run, list, stop, and remove Docker containers.
Writing a Dockerfile
Build an image from a Dockerfile with multi-instruction layers.
Volumes & Bind Mounts
Persist data with named volumes, anonymous volumes, and bind mounts.
Networking
Create networks, attach containers, and expose ports.
Docker Compose
Define and run multi-container apps with compose.
Multi-Stage Build
Build artifacts in one stage and copy them into a slim final image.