Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a docker image from a running container

Tags:

docker

I want to create a docker image with a few customizations. I have an existing image of 16GB and I have launched it as a container. Now I have deleted all the unnecessary files from the container and committed it as a new image. But the new image is still showing 16GB. Actually the new image should have only ~1GB in size.

How can I create a new small size image from a running container? Steps followed:

1) launched a container from the 16GB image
2) deleted unwanted files from the container
3) committed new image from the container 

Thanks sarath

like image 998
SARATH CHANDRAN Avatar asked Apr 13 '26 15:04

SARATH CHANDRAN


1 Answers

If you just need to reduce the size of the existing image, export it using docker export and then import it using docker import.

This question might also help.

like image 199
b0gusb Avatar answered Apr 15 '26 11:04

b0gusb



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!