As shown below:nsenter -t 1 -m -u -n -i sh -c "echo hello world!" Add privilege permissions to the docker container and set pid: "host" Supplement: Execute shell scripts or commands in docker containers on the host Common command forms:docker exec -it master /bin/bash -c 'echo $PATH' docker exec -it master /bin/bash -c 'cd /home/bigdata/shell && ./test.sh' If the shell script involves environment variables, or prompts JAVA_HOME is not set, you can add the following command to the script export JAVA_HOME=jdk path Supplement: Run the commands executed in the container in Docker on the Docker host The script is as follows:docker exec -u root xxx(container name) bash -c 'command 1 && command 2' A practical example is as follows: docker exec -u root mycentos bash -c 'mkdir /home/test.txt && chmod 777 /home/test.txt && runuser - oracle -c "rm -rf /home/test.txt"' The above is my personal experience. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. If there are any mistakes or incomplete considerations, please feel free to correct me. You may also be interested in:
|
<<: Summary of tips for making web pages
>>: We're driving IE6 to extinction on our own
Table of contents 1. Event delegation Event Bubbl...
Official website address: https://dev.mysql.com/d...
We are in an era of rapid development of mobile In...
This article example shares the specific code of ...
The specific code of the sliding button made with...
It’s great to use CSS to realize various graphics...
1. Download 1. MySQL official website download ad...
In a web page, the <input type="file"...
1. Open port 2375 Edit docker.service vim /lib/sy...
When using MySQL, many developers often perform f...
MySQL 8.0.22 installation and configuration metho...
This article shares the specific code of JavaScri...
This article shares the specific code of js to ac...
Website compatibility debugging is really annoyin...
Please open the test page in a mainstream browser...