Got it

An error occurs when you run the docker exec command to execute the shell script on the host.

Created: Jul 30, 2019 03:24:18Latest reply: Jul 30, 2019 03:30:12 1413 1 0 0 0
  Rewarded HiCoins: 0 (problem resolved)

Run the script on the active node of the cluster. The goal is to create a new conda env and link it to jupyter.

Error: sudo docker exec jupyterhub bash /home/hadoop/scripts/bootstrap.sh during the execution of the bash: /home/hadoop/scripts/bootstrap.sh: No such file or directory command. I make sure that the sh file is in the correct location.


But if I copy the bootstrap.sh file into the container and then run the same docker exec cmd, it's OK. What am I missing here? I have tried to use a simple script with the following entries, but it throws the same error:


#!/bin/bash

echo "Hello"

The document clearly states:


The kernel is installed in the Docker container. The easiest way to do this is to use the installation command to create the bash script, save it to the master node, and then run the script in the jupyterhub container using the sudo docker exec jupyterhub script_name command.


Featured Answers
TingtingGG
Created Jul 30, 2019 03:30:12

Good day!

The docker exec command runs the command in the namespace of the container. One namespace is the file system. Therefore, unless the command is part of the image, directly written to the container, or you have already installed the host volume to map the host directory to the container, you will not be able to execute it. The host volume may be as follows:

docker run -v /host/scripts:/container/scripts -n your_container $your_image
docker exec -it your_container /container/scripts/test.sh

The host volume can be the same path on the host and container.

If the shell script is used, the I/O redirection can be used. For example:

docker exec -i $container_id /bin/bash

However, note that because the script content has replaced the terminal with a standard input, you cannot perform an interactive operation in this way. This is valid because the shell inside the container handles only the commands from stdin.
View more
  • x
  • convention:

All Answers
Good day!

The docker exec command runs the command in the namespace of the container. One namespace is the file system. Therefore, unless the command is part of the image, directly written to the container, or you have already installed the host volume to map the host directory to the container, you will not be able to execute it. The host volume may be as follows:

docker run -v /host/scripts:/container/scripts -n your_container $your_image
docker exec -it your_container /container/scripts/test.sh

The host volume can be the same path on the host and container.

If the shell script is used, the I/O redirection can be used. For example:

docker exec -i $container_id /bin/bash

However, note that because the script content has replaced the terminal with a standard input, you cannot perform an interactive operation in this way. This is valid because the shell inside the container handles only the commands from stdin.
View more
  • x
  • convention:

Comment

You need to log in to comment to the post Login | Register
Comment

Notice: To protect the legitimate rights and interests of you, the community, and third parties, do not release content that may bring legal risks to all parties, including but are not limited to the following:
  • Politically sensitive content
  • Content concerning pornography, gambling, and drug abuse
  • Content that may disclose or infringe upon others ' commercial secrets, intellectual properties, including trade marks, copyrights, and patents, and personal privacy
Do not share your account and password with others. All operations performed using your account will be regarded as your own actions and all consequences arising therefrom will be borne by you. For details, see " User Agreement."

My Followers

Login and enjoy all the member benefits

Login

Block
Are you sure to block this user?
Users on your blacklist cannot comment on your post,cannot mention you, cannot send you private messages.
Reminder
Please bind your phone number to obtain invitation bonus.