Is docker inspect -f '{{.Parent}}' a safe way to get the base image ID? -




i want automatically rebuild docker containers when base image changed. idea compare base image id of current tagged container id of base image in docker hub , run new build if differs.

getting latest base image id seems quite straight forward:

$ docker pull debian:latest >/dev/null 2&>1; docker images debian:latest -q sha256:a20fd0d59cf13f82535ccdda818d70b97ab043856e37a17029e32fc2252b8c56 

docker inspect has entry called "parent" seems contain id of image used in from directive:

$ docker inspect -f '{{.parent}}' dockertest-1 sha256:a20fd0d59cf13f82535ccdda818d70b97ab043856e37a17029e32fc2252b8c56 

since can't find documentation wonder if should rely on data build build pipeline.

the parent reference not point base image in from line of dockerfile, points next last layer in image. if build contains single layer can from line, adding second line dockerfile break scripts.

if know tag of base image (this sort of meta information isn't stored in image, you'll need track externally, perhaps adding label image), can search docker history of current image base image's current sha256. i'd use following arguments generate id list:

$ docker history --format '{{ .id }}' --no-trunc $image_id 




wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -