-1

I am just wondering is that possible to run one script (e.g. shell script, python script, etc.) in different environments?

For example, I want to run my script from Linux shell to docker container shell (which the container is created by the script)? In other words, keep the script executing the rest of commands on container (after into the container).

run.sh (#shell script)

sudo docker exec -it some_containers bash  #this command will lead me to docker container environment
apt-get install curl     # I want to also execute this command inside the docker container after I enter the docker container environment
# this is just one script
Community
  • 1
  • 1
xc2333
  • 99
  • 3
  • 10
  • 1
    Yep, not clear. :) Could you please try adding some shell example that demonstrates what you're getting at? I.e. the commands you run, then explain what they do, and explain what you'd like them to do. Usually, an example is worth a thousand words of explanation. – ghoti Feb 24 '18 at 08:07
  • `I am just wondering is that possible to run one script (e.g. shell script, python script, etc.) in different environments?` What do you mean by different environment? Linux/Unix or windows? Your question should be very clear. – Abhijit Pritam Dutta Feb 24 '18 at 08:54
  • I am so sorry that I made the question very unclear. I will improve my English and asking skill in the future. Thank you so much! – xc2333 Feb 24 '18 at 17:35

1 Answers1

0

Your question is not very clear, but it sounds like this is a job requiring two scripts - the first script runs in your "Linux shell", and needs to cause the second script to be placed into the container (perhaps by way of the dockerfile), at which point you can have the first script use docker exec.

Please see the answers on this question for more information.

Phil
  • 2,238
  • 2
  • 23
  • 34