10 Overlooked Docker Commands That Make Container Management Easier 🐳

I recently discovered docker compose ls, and my immediate reaction was: “Wait… this has been here the whole time?” 😅👏

It lists your Docker Compose projects. No hopping between directories. No trying to remember which folder contains that one Compose file. Just a quick overview.

That got me thinking: most of us get comfortable with a handful of Docker commands—ps, up, down, logs—and rarely venture beyond them.

But Docker has plenty of useful commands hiding in plain sight. Here are ten worth adding to your toolkit.

These examples use modern Docker Compose syntax: docker compose, not the older docker-compose. Replace example names like my-container and web with your container or service names.

1. docker compose ls: See Your Compose Projects

docker compose ls

You probably already use docker ps to list containers. This gives you a different perspective: Compose projects, including their names, statuses, and configuration file paths.

By default, it lists running projects. To include stopped projects that Docker still knows about:

docker compose ls --all

Need output for a script?

docker compose ls --format json

Why it’s useful: When you’re juggling several local stacks, this helps answer, “What projects do I actually have here?”

One important detail: it’s not scanning your disk for Compose files. It reports projects represented by Docker resources in the current Docker context. A project you’ve completely removed with docker compose down won’t remain as a historical entry.

2. docker compose ps --all: Find the Containers That Aren’t Running

docker compose ps --all

Run this from your project directory, or point Compose at its configuration using -f.

Unlike a running-container-only view, --all also shows stopped containers. That makes it handy for catching a service that started, immediately exited, and quietly ruined your afternoon.

You can narrow it down, too:

docker compose ps --all --status exited

Why it’s useful: A missing service isn’t always missing. Sometimes it’s sitting there with an exit code and a story to tell.

3. docker stats: Check Resource Usage Without Extra Tools

docker stats

Docker includes a live resource-usage view showing CPU, memory, network I/O, block I/O, and PID counts.

Watch a specific container:

docker stats my-container

Or get a single snapshot instead of a continuously updating display:

docker stats --no-stream

Why it’s useful: Before setting up a monitoring dashboard, you can quickly see whether a container is consuming a suspicious amount of memory or CPU.

It’s not a replacement for historical monitoring—but it’s excellent for “why is my laptop preparing for takeoff?”

4. docker top: See Processes Without Opening a Shell

docker top my-container

This lists the processes running inside a container without needing to enter it.

On Linux, you can also pass supported ps options:

docker top my-container -eo pid,ppid,user,args

Why it’s useful: Minimal images may not contain a shell or tools like ps. docker top lets you inspect processes without installing anything inside the container.

A useful Linux detail: the displayed PIDs are typically from the Docker host’s perspective, not the container’s PID namespace.

5. docker logs Filters: Stop Reading the Entire History

Plain docker logs is familiar. Its filtering flags deserve more attention.

docker logs --since 15m --tail 100 --timestamps my-container

This limits the output to recent logs, caps the initial output at the latest 100 lines, and adds timestamps.

To keep following new output:

docker logs --follow --since 15m --tail 100 my-container

For a Compose service:

docker compose logs --follow --tail 100 web

Why it’s useful: You can jump straight to the relevant time window instead of scrolling through thousands of lines of yesterday’s problems.

Remember: these commands show output captured by Docker’s logging setup, usually stdout and stderr—not arbitrary log files inside the container.

6. docker inspect --format: Get the Detail You Actually Need

Running docker inspect without a filter can produce a small novel of JSON.

Use --format to extract a specific value:

docker inspect --format '{{.State.Status}}' my-container

Check an exit code:

docker inspect --format '{{.State.ExitCode}}' my-container

See whether Docker recorded an out-of-memory kill:

docker inspect --format '{{.State.OOMKilled}}' my-container

List mounted storage:

docker inspect --format '{{json .Mounts}}' my-container

Why it’s useful: These focused queries are easier to read and more useful in scripts than manually hunting through the full output.

7. docker diff: Find Files Changed Inside a Container

docker diff my-container

This shows filesystem changes in the container’s writable layer relative to its image.

The output uses three markers:

  • A — Added
  • C — Changed
  • D — Deleted

For example:

C /etc
C /etc/app.conf
A /tmp/debug-output.txt

Why it’s useful: It can reveal files created at runtime or configuration changes made during debugging.

The catch: this is a list of changed paths, not a line-by-line content diff. It also doesn’t track changes inside mounted volumes or bind mounts.

8. docker events: Watch What Docker Is Doing

docker events --filter type=container

This streams container lifecycle events, including starts, stops, exits, and restarts.

To focus on one container and include recent available events:

docker events --since 30m --filter container=my-container

Why it’s useful: Application logs tell you what happened inside your app. Events help explain what Docker was doing around it.

That distinction matters when you’re investigating restart loops or unexpected exits.

Docker retains only a limited event history, so treat this as a troubleshooting tool—not a durable audit log.

9. docker cp: Copy Files Without Extra Ceremony

Copy a file out of a container:

docker cp my-container:/tmp/debug-output.txt ./debug-output.txt

Or copy one in:

docker cp ./sample.json my-container:/tmp/sample.json

It works with stopped containers, too.

Why it’s useful: You can retrieve diagnostic files after a container exits, without rebuilding the image or starting an interactive shell.

Just don’t turn it into your deployment process. Changes copied into a container’s writable layer disappear when that container is removed. Dockerfiles and persistent storage exist for a reason.

10. docker port: Find the Published Port

docker port my-container

This lists the container’s published port mappings.

To look up a specific container port:

docker port my-container 8080/tcp

Compose has an equivalent:

docker compose port web 8080

Why it’s useful: No more squinting at a long docker ps row to figure out which host port maps to your application.

This reports published mappings—not every port the application might be listening on internally.

The Takeaway

You don’t need to memorize the entire Docker CLI. But a few overlooked commands can make everyday troubleshooting much easier:

  • Find your projects: docker compose ls
  • Catch stopped services: docker compose ps --all
  • Check resource usage: docker stats
  • Inspect running processes: docker top
  • Narrow your logs: docker logs --since … --tail …
  • Extract container details: docker inspect --format …
  • Spot filesystem changes: docker diff
  • Watch lifecycle activity: docker events
  • Retrieve files: docker cp
  • Look up port mappings: docker port

Sometimes the productivity upgrade isn’t a new tool. It’s discovering that the tool you already use has a command for the thing you’ve been doing the hard way.