Is the file in docker folder named lower can not edit?

The path of the file is var/lib/docker/overlay2/id, every folder has one. I edited one,and restored it.But I can never run the image again. What shuold I do?

You could start with sharing your motivation why you felt what you did would make sense…

1 Like

I want to migrate the top layer of one enhanced images(like ubuntu installed vim) to another machine which docker just has a base image(ubuntu without vim),and restore the relationship of the layers.I think editing the file in that path named lower is a key step.

The normal way is to write a Dockerfile, build the image and either push it to a (if wanted private) registry or save the image via docker save {image:tag} | gzip > myimage_latest.tar.gz .

Then on other maschine either pull the image from the registry or load the image via docker load --input myimage_latest.tar.gz If the very same base image exist on both machines, only the new layers will be imported.

If this is not what you want you will need to wait for someone that actualy is aquinted with the approach you try to do. I would strongly recommend to either use a registry or work with save/load instead.

I know this save&load way, but my ultimate goal is to minimize the amount of data transferred between the two machines.Thank you very much,I’ll try to find a way to achieve my goal, and I’m beginning to think your method is also very reasonable.

What about running a registry on the source machine and making it accessible from the target machine? If you have SSH access between the two machines, you could bind the registry to a local IP like and and use SSH port forward to access that IP from the target machine. Then you could just pull the images and only the missing layers would actually be pulled.

Downside of this would be that you would somewhat duplicate your data on the source machine.

This approach is not as good as running the registry on an external machine independently from source and target, which is what @meyay suggested I think, but if you don’t have an other machine or you need to keep everything in a very restricted environment, at least it could work.


I also need to add that you should never edit the overlay2 files manually. I like to play with the filesystem to learn, but I don’t think I would ever rely on that. Even if you can edit something it is not meant to be edited and you can break your image.

Thank you for your advice, and I’ll try this way.