Low Orbit Flux Logo 2 D

Docker How To Find Container Id

Finding a Docker container ID is easy.

To start you should see the ID in the output from the docker ps command:

docker ps

If you just want the IDs by themselves you can use the -q parameter like this:

docker ps -q

The above would return a list of IDs.

If you want to return the list of IDs for a specific container you can use the following

sudo docker ps -aqf "name=^mycontainer$"

On MacOS and Windows you won’t need “sudo” at the beginning of the command. The regex anchors “^” and “$” help you avoid matching containers with similar names.