Execute host shell script from meteor container

I have shell script on my host. I’ve installed docker container with meteord image. I have it running, however I would like to execute this shell script inside meteord docker image. Is that possible?

  • Bash variable inside third remote server
  • artifactory oss docker 5.0.0 upgraded to 5.1.0 now it won't start
  • Pulling image from local docker insecured Docker registry to Kubernetes
  • Getting error when running mocha test with Xvfb and firefox headlessly in a docker container
  • Consul not deregistering zombie services
  • mysql container linking to only one containers
  • Creating first image on bluemix docker
  • Docker container shows running even after exit command
  • Docker Shipyard - deploying a container to a specific node
  • Why Can't I Access Service in Docker Swarm by its Name or VIP?
  • dotnet docker /bin/sh: 1: [dotnet,: not found
  • Using Docker for development and sharing dependencies for features such as IDE auto-completion
  • One Solution collect form web for “Execute host shell script from meteor container”

    Yes. That is possible but you will have to copy the script in the container as follow:

    docker cp <script> <container-name/id>:<path>
    docker exec <container-name/id> <path>/<script>

    For example:

    docker cp script.sh silly_nightingale:/root
    docker exec silly_nightingale /root/script.sh

    Just make sure the script has executable permissions. Also, you can copy the script at build time in Dockerfile and run it using exec afterwards.


    You can also try docker volume for it as follow:

    docker run -d -v  /absolute/path/to/script/dir:/path/in/container <IMAGE>

    Now run the script as follow:

    docker exec -it <Container-name>  bash /path/in/container/script.sh

    Afterwards you will be able to see the generated files in /absolute/path/to/script/dir on host. Also, make sure to use absolute paths in scripts and commands to avoid redirection issues. I hope it helps.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.