Duplicating docker container for debugging

后端 未结 5 570
遥遥无期
遥遥无期 2020-12-14 14:48

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 c

5条回答
  •  独厮守ぢ
    2020-12-14 15:33

    If you have a container my-cont and you want to debug it, there is no need to install debugging tools inside it. What you can do instead is to use another container from a debug image e.g. xyz_docker_img then let it shares the same namespaces with my-cont container with extra capabilities you need for debugging.

    $ docker run -it \
                    --pid=container:my-cont 
                    --net:container:my-cont
                    --cap-add NET_RAW 
                    --cap-add NET_ADMIN 
                    --cap-add SYS_PTRACE
                    xyz_docker_image bash
    

提交回复
热议问题