Introducing nsenter
nsenter is a small tool allowing to enter into namespaces. Technically, it can enter existingnamespaces,
or spawn a process into a new set of namespaces. “What are those
namespaces you’re blabbering about?” They are one of the essential
constituants of containers. The short version is: with nsenter, you can get a shell into an existing container, even if that container doesn’t run SSH or any kind of special-purpose daemon.
Where do I get nsenter?
Check jpetazzo/nsenter on GitHub. The short version is that if you run:docker run -v /usr/local/bin:/target jpetazzo/nsenter
nsenter in /usr/local/bin and you will be able to use it immediately. nsenter might also be available in your distro (in the util-linux package).How do I use it?
First, figure out the PID of the container you want to enter:PID=$(docker inspect --format {{.State.Pid}} )
nsenter --target $PID --mount --uts --ipc --net --pid
nsenter. It works a bit like chroot, except that it works with containers instead of plain directories.Reference:
Backup data, check logs, restart service ... use volume
https://docs.docker.com/userguide/dockervolumes/
No comments:
Post a Comment