Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Build your own Docker image

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Container to Image (not recommended)

Create a container with centos image, modify the contents of the container

docker image ls

docker run -it centos

yum install -y vim

exit

If you want to understand the learning route of big data, want to learn big data knowledge and need free learning materials, you can add group: 784789432. Welcome to join. Every day at 3 p.m. live broadcast to share basic knowledge, at 20:00 p.m. live broadcast to share big data project actual combat.

Looking at the container and converting it to an Image, I noticed that it was slightly larger than the native centos. Create new image name liming/centos-vim

docker container ls -a

docker commit

docker commit container name liming/centos-vim

docker image ls

Look at the layer relationship of the new image. The newly created image is actually adding a layer above the centos layer.

docker history Container ID

Container ID of docker history centos

The above method of publishing an Image is actually not recommended and unsafe, because of the possibility of publishing an unstable Image.

Docker build means Dockfile (recommended)

Delete images and containers created earlier

docker image rm liming/centos-vim

docker image ls

docker container ls

docker container ls -a

docker container rm c5a14ab5c071

docker container ls -a

docker container ls

Creating Dockerfile

mkdir docker-centos-vim

cd docker-centos-vim/

vim Dockerfile

Edit Dockerfile

FROM centos

RUN yum install -y vim

Dockerfile build

docker build -t liming/centos-vim-new .

PS: Why do you recommend Dockerfile, because files can be edited at will, if you use containers, how can you send trouble to others? It's still convenient for a single file.

past exciting

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report