During docker load, lasttagtime changed to default time

I have created and save the docker image using “docker save”, but while doing “docker load” command I get the latest docker images.
But when I use docker image inspect IMAGE_ID ,

The below field values was changed to default values as “0001-01-01T00:00:00Z” but it should not be changed how to achieve this.

Field : “LastTagTime”

Since I don’t think your question was related to Docker Hub, I moved the topic to the “DockerEngine” category.
Please, share why you thought the “Docker Hub” category was approrpiate for your question, so we can work on better category names. Thank you!

I’m not sure what you mean by latest docker images. What did you expect?

The LastTagTime field is available only in images that you locally tagged. When you build an image you usually also tag it. I guess when you load an image that counts as pulling the image from a registry which never stores the last tag time. I haven’t even figured out yet what I could use the LastTagTime for.

Hi @rimelek .,

Thanks for changing the category from docker hub to docker engine.

While posting the questions I thought docker hub will be suitable category, because I’m new to docker stuff.

Below was the process I’m following.

  1. Build the image in server1
  2. Save the image file as “.tar” file.(using ‘docker save’ command)
  3. The saved file(.tar file) was moved to another server2.
  4. To load the docker image in another server2, we are using “docker load” command.
  5. After step we are getting the latest images list using the command ‘docker images’
  6. We are inspecting the lastest image using the command ‘docker image inspect IMAGE_ID’
  7. In this command output the “LastTagTime” was changed to default values “0001-01-01T00:00:00Z”

But we have checklist to ensure the “LastTagTime” need to be same as the time we got in server1 .

Don’t rely on that value. What is your goal? That is still not clear to me, so I can’t recommend an alternative solution.

Hi @rimelek .,

Thanks for the support.

My goal:

When I build the image in server1, I got the value in LastTagTime as “2023-09-18T08:42:34.908634274+05:30” but after moving the .tar file to server2 and I used “docker load < test.tar” file command.
After that when I inspect the lastest image I got the LastTagTime as “0001-01-01T00:00:00Z”

But as per my goal, the “LastTagTime” shouldn’t get change.

That’s not a goal. That a way you chose to achieve a goal but that is most likely not the good way.

Thanks.

Whether to achieve my goal can I use the field “Created” , because as per my understanding the “Created” field will not change when we load the tar file in server2.

If you have any other better suggestion please suggest.

Since I still don’t know your goal, I can’t say, but if it is to list images in the order of the time they were created/built, then yes.

About the difference of a goal and the way to achieve it:

If I say I want to eat candy, you could ask why. And I would say “because I’m hungry”. That would be my goal. Eating candy would be just a way I would think I could achieve this, but that wouldn’t be the right way. The right way would be eating proper food. What proper food is depends on whether someone is a vegan, vegetarian or omnivore.

So without enough information, we can’t tell you what you should do. I can only tell you that you should not use the LastTagTime, unless you want to search for images built on your machine and images that got additional tags even though they were pulled from a registry

Thanks .

Better I will follow with “Created” field.
Thanks for the support.