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

Is the docker commit container stopped?

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

Share

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

This article introduces to you whether the docker commit container is stopped, the content is very detailed, interested friends can refer to, hope to be helpful to you.

Must the docker commit container be stopped? The docker container provides the function of commit. If Docker commit saves the container as a new image, it must exit the container first.

Let's take centos as an example. Now we need to install a vim editor on a naked centos, save this function, and package it into a centos image that can execute vim commands.

Pull the latest centos image:

Docker pull centos

Enter inside the image:

Docker run-it centos / bin/bash

[root@202 ~] # docker run-it centos / bin/bash [root@afcaf46e8305 /] #

Afcaf46e8305 is the generated container ID. Do not run it in the background when you run it earlier, otherwise you will not be able to enter the container.

[root@afcaf46e8305 /] # yum update [root@afcaf46e8305 /] # yum install-y vim

After installation: exit exits the container

Then package the container into an image:

Root@202 ~] # docker commit afcaf46e8305 centos-vim

When docker images checks the image, he will find that centos-vim is a mirror image.

Then use the method just now to enter the image of centos-vim.

[root@7f2d42f3e0a3 /] # vim-- version

You can see the information of vim.

This is the end of sharing about whether the docker commit container is stopped or not. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.

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

Servers

Wechat

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

12
Report