When I run docker ps
,it shows image IDs in the 2nd column:
But i want it to show image names:
what should I do ?
docker ps | show image name instead of ID
1.2k Views Asked by nyzhao At
2
There are 2 best solutions below
0

It's probably because in the meantime the image name and tag was assigned to a different image.
reproduce:
docker pull ubuntu:22.04
docker tag ubuntu:22.04 myimage:mytag
docker run myimage:mytag
here if you do a docker ps -a
you will see the container has myimage:mytag
in the IMAGE column, however if you now tag a different image with this myimage:mytag
:
docker pull debian:buster
docker tag debian:buster myimage:mytag
you will see the IMAGE ID in the IMAGE column of docker ps -a
for the previous container because that tag doesn't belong to that image anymore.
Use this command to get image name :
docker ps -a --format 'table {{.Image}}'
And this command for container name:
docker ps -a --format 'table {{.Names}}'