Validate a Container With Docker Ls

Is a Docker container available on a registry? Here’s how I’d check, right from the CLI: docker image ls <container-name> You could use this when doing an upgrade. Perhaps we’re upgrading Debian to Bookworm, and we don’t know which Python versions are available on our new OS version. This command will tell you. $ docker image ls python:3.10.12-slim-bookworm # Exists 😊 IMAGE ID DISK USAGE CONTENT SIZE EXTRA python:3.10.12-slim-bookworm 4d440b214e44 244MB 52.3MB $ docker image ls python:3.10-slim-bookworm # Doesn't exist 😔 IMAGE ID DISK USAGE CONTENT SIZE EXTRA Both return exit code 0, success. You can force exit code 1 for scripting with docker inspect <container-name>. ...

April 9, 2026

Docker Service Healthy

Docker gives you a way to control startup, while codifying that one container depends on others. An example is most helpful here: services: web: build: . depends_on: db: condition: service_healthy restart: true redis: condition: service_started redis: image: redis db: image: postgres:18 healthcheck: test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"] interval: 10s retries: 5 start_period: 30s timeout: 10s With this configuration, services are created in dependency order: web will come up only after redis is started and db healthy, as defined in the healthcheck. ...

February 20, 2026

Docker Compose Override

Need to override some Docker configuration locally? Too easy! Docker automatically reads an override file on your machine. “By default, Compose reads two files, a compose.yaml and an optional compose.override.yaml file. By convention, the compose.yaml contains your base configuration. The override file can contain configuration overrides for existing services or entirely new services.” Edit docker-compose.override.yml with your local overrides. I’ve used this to pass environment variables in development with no code changes. ...

February 20, 2026

Docker Build No Cache

Sometimes your Docker build is cached, and you need to build without cache. Symptoms of this predicament: you build the container, take it down and up, and don’t see your changes. And maybe see outdated files on the container filesystem. Build without cache: docker compose build --no-cache

November 21, 2025

Tail Docker Logs

Here’s how you tail a Docker log. docker logs --follow <container_name> See docker logs --help for more.

November 5, 2025

Docker Compose Watch

One of my projects features a Dockerized API. The dev process was: write a file, rebuild container, and restart container. There’s a better way! Add this to your docker-compose.yml (path and target directories will be unique to your project): develop: watch: - path: ./ target: /app/ action: sync+restart Then, start your container with --watch. docker-compose up --watch api Now, anytime I write a file, Docker quickly copies it into my target directory and restarts the container. This reduced iterations from over a minute to under ten seconds. ...

September 12, 2025