How do I migrate the top layer of one images to another machine?

I want to migrate the top layer of one enhanced images(like ubuntu installed vim) to another machine which docker just has a image(ubuntu without vim),and restore the relationship of the layers.