Runtime.getRuntime().exec on host from inside a Docker process

I have a Java program that runs inside a Docker container. This program needs to execute a shell command that should be run by the host system, but just calling Runtime.getRuntime().exec(...) executes it inside the Docker container (as it should be).

Is there a way I can start a process from inside a container so the process runs outside? I suspect that the exec command should go via Docker to tell it that the command itself needs to be run on the host, but I’m not sure how to do that.

  • Linux Namespaces: Is it possible for a network namespace to exist without being associated with a process?
  • Changing the default command of base docker images
  • docker volume plugin not properly detected by docker engin
  • “Memory used” metric: Go tool pprof vs docker stats
  • Cannot connect Npgsql to Postgres DB running on Docker
  • teamcity and docker integration
  • Default arguments in Docker
  • Disk out of space on Azure Web app on Linux
  • installing docker cloud cli on windows
  • docker-compose can't connect to external network
  • How to switch between active docker machine on window
  • Starting a container only after the previous container is Running
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.