I have a monolithic Django web app that has a few software dependencies other than Python packages that are all currently installed on a single Linux (Ubuntu 18.04) instance. Some of those software dependencies are installed as Docker containers, and some of them are Node.js and Go packages that are installed along with their respective environments. The softwares are invoked by running a CLI command using an os.subprocess()
call from Python (for the Docker containers the command is prefixed by docker exec -it <container_name>
).
What I’m now trying to do is to Dockerize this monolithic web app using Docker Compose.
Let’s say I have four Docker containers now for the softwares A, B, C, and D, along with those for Django and Apache. I have a few doubts:
-
Can I still run commands in these containers from my Django container? If yes, then how? (Apart from writing an API on those containers and exposing it to my Django container, and communicating via HTTP)
-
How do I scale these containers depending on the load (amount of CPU or memory used)?
-
How will I be able to run commands on the scaled containers?