What command do I run to get the container ID of an image?
I would think docker ps -a something…
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
17ef697da46d local_django "/entrypoint /start" 56 minutes ago Up 56 minutes 0.0.0.0:8000->8000/tcp django-1
I only want the container ID returned from an image search
2
Answers
You can add the
-q
option to only get the ID back. And the-f
option to filter on ‘ancestor’ which means the image name or any image in the chain of images it’s based on.Based on image
You can get it based on name as well
Also to get all container ids