安装:
cd /tmp; curl https://www.kernel.org/pub/linux/utils/util-linux/v2.25/util-linux-2.25.tar.gz | tar -zxf-; cd util-linux-2.25
sudo apt-get install autopoint autoconf libtool automake
./configure --without-python --disable-all-programs --enable-nsenter --without-ncurses
make nsenter; cp nsenter /usr/local/bin
使用:
docker inspect -f {{.State.Pid}} 容器id
5270
nsenter --target 5270 --mount --uts --ipc --net --pid
[size=medium][color=red]退出容器 容器不会关闭[/color][/size]
cd /tmp; curl https://www.kernel.org/pub/linux/utils/util-linux/v2.25/util-linux-2.25.tar.gz | tar -zxf-; cd util-linux-2.25
sudo apt-get install autopoint autoconf libtool automake
./configure --without-python --disable-all-programs --enable-nsenter --without-ncurses
make nsenter; cp nsenter /usr/local/bin
使用:
docker inspect -f {{.State.Pid}} 容器id
5270
nsenter --target 5270 --mount --uts --ipc --net --pid
[size=medium][color=red]退出容器 容器不会关闭[/color][/size]
本文介绍如何通过安装并使用nsenter工具进入Docker容器的PID命名空间,实现对容器内部进程的管理和调试。文章详细展示了nsenter的安装步骤及如何指定参数进入特定容器。
1048

被折叠的 条评论
为什么被折叠?



