I have many existing docker containers that are run using network=host parameter (configured at "docker run -D <params>"). I have a requirement to switch to another network type. I would prefer to make the transition as simple as possible. Further, since most of the services running on these containers are listening on specific ports, and since users calling these services already have clients created that call these endpoints, I have a need to choose a docker network solution that does not require the users to change how they currently call the endpoints.
For instance, if the user currently makes a call like:
curl -X POST "ourCurrentHost:8099/rest/endpointA?user=jsmith
, I want that to remain unchanged if possible. I am thinking that this may be possible by defining my own docker bridge network. I see very basic examples of creating such a network, like:
$ docker network create --driver bridge my_isolated_bridge_network
, and then you can run a container you want on that network by configuring at runtime like:
$ docker run --net=my_isolated_bridge_network --name=my_psql_db postgres
However, much less obvious to me is how to bridge this network to the underlying network of the host server the container is running on (I assume this is what is needed so that the client calls can remain unchanged).
Another consideration is that some of my containers make calls to other containers running on the host server network (i.e. the network my containers were running on before I had to switch away from network=host).
Also, I have not been using docker compose up until now either, but just CLI. I would rather continue doing that for now as well.
I am not certain how I should proceed. I would be grateful for any ideas/suggestions. Thank you.