can a dockerised app execute script on the host?

If I have an application running in a docker container, is it possible to have it execute a shell script on the host? I’m pretty sure there is no way to achieve this – on purpose, such is the nature of containers – but want to check. Thanks.

EDIT: and failing that, is there a way for the app to interact with the docker engine running on the host so that it can trigger a “docker stop” “docker run..” etc for other containers.

  • Cannot (apt-get) install packages inside docker
  • Start a service within docker container
  • Docker nancy - no route to host
  • Running Gatling from docker-compose
  • Docker communication to hardware on host
  • How to get the docker container logs using docker-java client library
  • Cannot copy files from docker to tmp of host using docker-compose
  • Starting Docker containers from PHP
  • docker-machine:Error with pre-create check: “exit status 126”
  • Docker container not showing volume mounted - Access issue
  • Play Framework - Passing Application Arguments via Docker Container
  • Fedora 22: ERROR: No module named '_rpmb' while building docker
  • One Solution collect form web for “can a dockerised app execute script on the host?”

    Well, technically, it does. Processes are run on the host even when from inside a container. You can verify this when running ps aux as root on the host : you’ll see the dockerized processes.

    The question is : what interaction is your script supposed to have with the system ? If it’s taking files as input, accessing databases or network resource, then all of this is possible for a dockerized script. You’ll just have to define volumes and links.

    About the docker engine : yes it is also possible for a container to control its own docker engine. You just have to add this to the docker command :

    -v /var/run/docker.sock:/var/run/docker.sock

    That way, a docker client (inside the container) will have access to the docker engine (via docker API).

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