简体   繁体   English

如何保存 Docker 图像可写

[英]How to save Docker image writable

I found out that docker image is read-only.我发现 docker 图像是只读的。 Is there a way to save the image writable?有没有办法保存可写的图像?

The reason why I post this question is because I want to modify the original image.我之所以发布这个问题是因为我想修改原始图像。 Delete or Update from the base image inside container.从容器内的基础镜像中删除或更新。

When you build an image it is immutable but if you want to modify something from an other image you can create a Dockerfile from an image that you want to modify with FROM command.当您构建映像时,它是不可变的,但如果您想从其他映像修改某些内容,您可以从要使用 FROM 命令修改的映像创建 Dockerfile。

With RUN, COPY and other commands you can create your personal image.使用 RUN、COPY 和其他命令,您可以创建您的个人形象。

What kind of changes do you want to do?你想做什么样的改变?

When working with Docker images and containers, one of the basic features is committing changes to a Docker image.使用 Docker 映像和容器时,基本功能之一是提交对 Docker 映像的更改。 When you commit to changes, you essentially create a new image with an additional layer that modifies the base image layer.当您提交更改时,您实质上创建了一个带有修改基础镜像层的附加层的新镜像。

Create a new image by committing the changes using the following syntax:通过使用以下语法提交更改来创建新图像:

sudo docker commit [CONTAINER_ID] [new_image_name]

I hope this answer help you.我希望这个答案对你有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM