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.

  • Copy a file from host OS to docker image
  • Determine if new docker container available on docker hub
  • Kubernetes docker flannel subnet file not found
  • How to enable_ipv6 with docker compose version 3
  • Docker compose and volumes with Apache
  • Confusion while deploying docker-composer image
  • Unable to run docker commands
  • How do you set up selenium grid using docker on windows?
  • Dcos on premises , How out side world reach to docker container if we are using mesos-dns?
  • Cannot replace the software source inside docker Ubuntu image
  • how can i create a database on mysql docker service
  • How can I exclude a sub-directory with a .dockerignore file
  • 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.