brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: docker ps with no-trunc shows the full command a container runs

Docker
~/tips/tip-docker-ps-no-trunc-command

docker ps --no-trunc --format 'table {{.Names}}\t{{.Command}}'

See the complete start command and full IDs that docker ps normally cuts off.

The COMMAND column in docker ps is cut off after about twenty characters, with an ellipsis right where the interesting flags start. --no-trunc prints it in full.

docker ps --no-trunc --format 'table {{.Names}}\t{{.Command}}'

Now you see the whole entrypoint plus its arguments, for example which config file a process was started with. The same flag also shows full 64 character container IDs instead of the short twelve, which you sometimes need to match a folder under /var/lib/docker/containers or a cgroup path.

Without a --format, the full table gets very wide, so I’d always combine the two and pick the columns you need. Add -a to include stopped containers, which is handy when one exited and you want to see what it tried to run.

The column shows the command as Docker stored it, entrypoint and arguments joined together with quotes. If the image starts a shell script that launches the real program, you see the script, not the program. For that, docker top lists the processes that are actually running inside the container.

Further reading: docker container ls

More Docker tips ONBUILD RUN /usr/local/bin/python-build --dir /app/src SHELL ["/bin/bash", "-c"] docker commit <container> myname/testimage:version3 docker import /path/to/exampleimage.tgz docker compose events All Docker tips (192) All topics

Link