Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How make docker layer to single layer

Docker images create with multiple layers, I want to convert this to single layer is there any docker build command to achive this ? i googled for but cant find anything

like image 479
Rayees Namathponnan Avatar asked Dec 24 '22 01:12

Rayees Namathponnan


1 Answers

No command to achieve that, and a single layer image is against docker's design concept. This Understand images, containers, and storage drivers doc described why docker image has multiple layers. In short, image layers are one of the reasons Docker is so lightweight. When you change a Docker image, such as when you update an application to a new version, a new layer is built and replaces only the layer it updates. Besides, even your image has only one layer, when you create a container with that image, docker still will add a thin Read/Writable container layer on the top of your image layer.

If you just want to move your image around and think one single layer could make it easier, you probably should try to use docker save command to create a tar file of it.

Or you have more complicated requirements, you may need to use VM image rather than docker image.

like image 69
Haoming Zhang Avatar answered Jan 29 '23 00:01

Haoming Zhang