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>. ...