5 Essential Docker Tools to Boost Your Container Workflow
This article introduces five practical Docker utilities—Watchtower, docker‑gc, docker‑slim, rocker, and ctop—explaining their purpose, core commands, and how they can streamline container updates, cleanup, image slimming, Dockerfile extensions, and real‑time monitoring for developers and operators.
The Docker community has created many open‑source tools that help handle a variety of use cases. This article recommends five of the most useful Docker utilities: Watchtower, docker‑gc, docker‑slim, rocker, and ctop.
1. Watchtower – Automatic Docker container updates
Watchtower monitors running containers and checks whether the image they were started from has changed. When a new image is available it automatically restarts the container with the updated image. It runs as a Docker container itself.
Run Watchtower with:
docker run -d --name watchtower --rm -v /var/run/docker.sock:/var/run/docker.sock v2tec/watchtower --interval 30Example of a container that Watchtower can monitor:
docker run -p 4000:80 --name friendlyhello shekhargulati/friendlyhello:latestWatchtower polls Docker Hub by default; you can configure private‑registry credentials via REPO_USER and REPO_PASS environment variables. See the Watchtower documentation for more details.
2. docker‑gc – Garbage collection for containers and images
docker‑gc removes unused containers and images, deleting containers older than one hour and images not referenced by any container.
Run a dry‑run to see what would be removed:
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -e DRY_RUN=1 spotify/docker-gcRemove the DRY_RUN variable to actually delete the resources.
For full options see the docker‑gc README.
3. docker‑slim – Shrink Docker images
docker‑slim uses static and dynamic analysis to reduce the size of bulky images. After downloading the binary and adding it to your PATH, you can slim an image such as the 194 MB “friendlyhello” example.
Before slimming:
Example command: docker-slim build --http-probe friendlyhello After slimming the image size drops to about 24.9 MB while preserving functionality. docker‑slim supports Java, Python, Ruby and Node.js applications.
See the docker‑slim README for more information.
4. rocker – Extending Dockerfile syntax
Rocker adds new directives to Dockerfile, addressing image size and slow build speed. New directives include MOUNT, multiple FROM, TAG, PUSH, and ATTACH for interactive debugging.
Install on macOS:
brew tap grammarly/tap
brew install grammarly/tap/rockerSample Rockerfile snippet:
FROM python:2.7-slim
WORKDIR /app
ADD . /app
RUN pip install -r requirements.txt
EXPOSE 80
ENV NAME World
CMD ["python","app.py"]
TAG shekhargulati/friendlyhello:{{ .VERSION }}
PUSH shekhargulati/friendlyhello:{{ .VERSION }}Build and push an image with rocker: rocker d build --push -var VERSION-1.0 Refer to the rocker README for the full list of supported directives.
5. ctop – Top‑like interface for containers
ctop provides a real‑time view of multiple containers’ metrics. Install via Homebrew: brew install ctop After setting the DOCKER_HOST environment variable, run ctop to see all container statuses, or ctop -a to show only running containers.
These five Docker utilities can streamline container management, image size reduction, cleanup, and monitoring, helping developers and operators work more efficiently with Docker.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Programmer DD
A tinkering programmer and author of "Spring Cloud Microservices in Action"
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
