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?

  • docker ubuntu cron -f is not working
  • Docker: Unable to connect to container from host
  • docker registry with nginx: no such host
  • Best practices for managing SSH keys with Azure container service deployments
  • How to quickly switch between docker environments for development?
  • Docker php:5.6-apache 403 (because search permissions are missing on a component of the path)
  • Can't get docker to accept request over the internet
  • How can I set a static IP address in a Docker container?
  • Docker swarm — container binding to ethx IP
  • Run project dependencies commands from dockerfile
  • returned a non-zero code: 2 on EVERY SINGLE COMMAND in known good Dockerfiles
  • Magento2 Docker Devbox Exception
  • 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.

    Updated:

    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.