Connecting non-docker instance to a docker network


First of all, I am fairly new to the Docker world, so it is possible I missed something or I am doing something wrong.

My issue is the following:
I am developing a system based on a docker swarm, and for some reason, I need to be able to modify the number of containers, among other things, on the fly, depending on events that are not docker related. (To be precise, it is a Minecraft minigame server that needs new Minecraft instances whenever players request it)

So I choose to design my own orchestrator on top of Docker swarm.

I am designing a python service that will run on every manager node of my swarm to ensure a continuity of service if some of the manager nodes were to fail.
To ensure synchronism between the different orchestrator services I was hoping to be able to use the overlay network I created to connect the different containers.
This design would allow me easy scalability.
But I cannot figure out how to connect a non-docker service to a docker network.
A solution would be to put my orchestrator inside a docker container, but then it would not be able to create, add and destroy containers (if I am not mistaken).

I would be glad if someone could explain to me if it is even possible and in this case points me toward sources that would explain how.

I stay at your disposal for any need information about what I am doing.

Actualy you could:

  • the easy way: use a placement contraint to place your managing container on a manager node, bind mout /var/run/docker.sock to the container, use the bind mounted docker.sock inside the container to controll the docker engine.
  • the hard way: add a tcp listener to your docker engines, run your container on any node and use the tcp connection to controll the docker engine using the tcp endpoint. If the docker engine is reachable from a public network, make sure to understand the necessity and adapt Protect the Docker daemon socket | Docker Documentation to use mutual tls for authentification with your application.