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. Installation 2.APi 3. react-...
Preface To help ensure that your web pages have a ...
1. Introduction The difference between row locks ...
Recently, the client of a project insisted on hav...
Table of contents 1. New usage of watch 1.1. Watc...
Table of contents 1.watch monitors changes in gen...
Table of contents 1. Docker installation on Mac 2...
Table of contents Mysql master-slave synchronizat...
CSS realizes the process navigation effect. The s...
Using Dockerfile allows users to create custom im...
Click here to return to the 123WORDPRESS.COM HTML ...
Table of contents Parent component communicates w...
Adobe Brackets is an open source, simple and powe...
Table of contents question 1. Install webpack web...
1. Background When the Docker service is started,...