Build and push new image only when base image is changed

Hi,

I want to be able to build and push new images only when the base image has changed. Currently I have been able to achieve this by pulling the base image and re-building the image and then push only if image ID has changed. It all works well till i have to do this in a new VM. On a new VM, i first pull the pushed image and then re-build it but for some reason, when i inspect the image then I find out that only the image.container and image.ContainerConfig.Hostname fields have changed. Can someone explain what these fields are and how could i possibly keep them from changing?

Thanks!