title: Docker Network - moving from host to bridge
body: <p>I have many existing docker containers that are run using network=host parameter (configured at &quot;docker run -D &lt;params&gt;&quot;). 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.</p>
  <p>For instance, if the user currently makes a call like:</p>
  <pre><code>curl -X POST &quot;ourCurrentHost:8099/rest/endpointA?user=jsmith
  </code></pre>
  <p>, 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:</p>
  <pre><code>$ docker network create --driver bridge my_isolated_bridge_network
  </code></pre>
  <p>, and then you can run a container you want on that network by configuring at runtime like:</p>
  <pre><code>$ docker run --net=my_isolated_bridge_network --name=my_psql_db postgres
  </code></pre>
  <p>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).</p>
  <p>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).</p>
  <p>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.</p>
  <p>I am not certain how I should proceed. I would be grateful for any ideas/suggestions. Thank you.</p>