Get the last Docker image built - Stack Overflow
stackoverflow.com › questions › 50787345Jun 11, 2018 · A consistent solution would be to sort them by the creation date and get the latest one. I used the following command, this is consistent. docker images --format " { {.ID}} { {.CreatedAt}}" | sort -rk 2 | awk 'NR==1 {print $1}'. This command sorts the output of the docker images command by CreatedAt column and print the id of the latest image.
docker pull | Docker Documentation
https://docs.docker.com/engine/reference/commandline/pullDocker uses a content-addressable image store, and the image ID is a SHA256 digest covering the image’s configuration and layers. In the example above, debian:jessie and debian:latest have the same image ID because they are actually the same image tagged with different names. Because they are the same image, their layers are stored only once and do not consume extra …