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

Docker commands to install nsenter

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article focuses on "docker installation nsenter commands", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor to take you to learn "docker installation nsenter commands" it!

$wget https://www.kernel.org/pub/linux/utils/util-linux/v2.27/util-linux-2.27.tar.gz$ tar-zxvf util-linux-2.27.tar.gz$ cd util-linux-2.27 $. / configure-- without-ncurses & & make nsentercp nsenter / usr/local/bin

Gcc needs to be installed

Yum install-y gcc$ sudo docker run-idt ubuntu$sudo docker ps$ PID=$ (docker-pid 243c32535da7)

The ps:docker-pid command indicates that there is a problem

$wget-P ~ https://github.com/yeasy/docker_practice/raw/master/_local/.bashrc_docker;$ echo "[- f ~ / .bashrc_docker] & &. ~ / .bashrc_docker" > > ~ / .bashrc; source ~ / .bashrc

Enter the container

PID=$ (docker inspect-- format "{{.State.Pid}}")

With this PID, you can connect to the container:

Nsenter-- target $PID-- mount-- uts-- ipc-- net-- pid

A complete example is given below.

$sudo docker run-idt ubuntu243c32535da7d142fb0e6df616a3c3ada0b8ab417937c853a9e1c251f499f550 $sudo docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS 243c32535da7 ubuntu:latest "/ bin/bash" 18 seconds ago Up 17 seconds $PID=$ (docker-pid 243c32535da7) 10981$ sudo nsenter-target 10981-mount-uts-ipc-net-pidroot@243c32535da7:/#

More simply, it is recommended that you download .bashrc _ docker and put the content in .bashrc.

$wget-P ~ https://github.com/yeasy/docker_practice/raw/master/_local/.bashrc_docker;$ echo "[- f ~ / .bashrc_docker] & &. ~ / .bashrc > > ~ / .bashrc; source ~ / .bashrc so far, I believe you have a deeper understanding of" docker installation nsenter command ", you might as well do it in practice! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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