复制码头码头容器进行调试 [英] Duplicating docker container for debugging

查看:131
本文介绍了复制码头码头容器进行调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行的码头容器。我已经在运行的docker容器中做了一些有用的工作。我已经完成了这些工作,不是docker文件的一部分,我已经在容器内部完成了这个工作。例如:我已经在容器内部安装了ping,而不是从docker文件中安装)



我被困在一个地方。我不知道我是否在同一个容器中进行调试,我可能会放弃我在该容器内到目前为止所做的一切。



所以我想创建一个重复复制它与运行容器中可用的所有东西[像我不想从映像构建容器,并重复在运行容器中实现的所有有用步骤,然后启动我的调试。我不想在我的第二个容器中重新安装ping。]



总的来说,我如何复制容器?如果不是所有的可能性?

解决方案


  1. 创建基本图像并运行

      docker run -it< base_image> / bin / bash 


  2. 进行必要的更改

      yum install ping 


  3. 提交它使用新名称

      docker commit<运行容器的哈希标签> new_image 







现在,如果您通过运行

  docker run -it new_image / bin / bash 

您可以在其中看到 ping



打开base_image,安装没有 ping



希望它回答你的问题。


I have a running docker container. I have done some useful works in the running docker container. I have done these works not part of dockerfile, i have done it inside the container.[Eg: I have installed ping inside the container, not from docker file]

Now, i got stuck at a place. I am not sure if i debug in the same container, i may loose the thing that i have done so far inside that container.

So i would like to create a duplicate copy of it with all the things available in that running container[like i don't want to build a container from image and repeat all the suucessful steps achieved in the running container and then start my debuggging. I don't want to re-install ping in my second container].

Totally, How can i duplicate a container? If not what are all the possibilities?

解决方案

  1. Create a base image and run it

    docker run -it <base_image> /bin/bash
    

  2. Make necessary changes

    yum install ping
    

  3. Commit it with a new name

    docker commit <hash tag of running container> new_image
    


Now if you open new_image by running

docker run -it new_image /bin/bash

You can see ping is installed in it.

Open base_image and there is no ping installed in it.

Hope it answered your question.

这篇关于复制码头码头容器进行调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆