I'm in a situation where I have a Django application, Nginx webserver and Postgres database that I want to dockerize, and that's no issue I can do that. But the Django application has code that calls a subprocess to run a command from a installed program on the root host, and obviously if I run that command it's not recognized since it's not installed on the docker container.

The program can not be dockerized as far as I know, because it uses docker itself. Is there any way I can make the Django Application be able to run commands from that specific program on the root host, even though the Django application is containerized?

Can this be done through some kind of network setup of the docker container?

I find it a little hard to explain, so please do ask questions if something isn't clear enough.

1 Answer 1


This StackOverflow question has answers that could be useful for you, in particular, mounting parts of the hosts filesystem containing the host application.

But really, it doesn't seem to make much sense to run an application in a container and then try to directly access the host system. It seems to defeat many of the reasons to containerize an application in the first place.

It'd probably much better to put the required application in the container, along with Django. I see no reason why your container wouldn't be able to run docker itself (even though for some CI/CD use cases sibling containers are preferred over docker-in-docker approach).

  • 1
    You're right it doesn't make much sense. I wanted to dockerize the whole project so I could add a container orchestrastor, but the only issue is that one application. I've asked the developers of this application about dockerizing it, but they've tried and found it apparently made it unstable when using docker-in-docker. Maybe I should just wait and see into the future, maybe a solution might pop up. I appreciate you taking the time and answering my question though.
    – Super doe
    Commented Jan 17, 2020 at 20:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.