Docker Community Forums

Share and learn in the Docker community.

Running two containers simultaneously on same host

I have one container running on 127.0.0.1 and I am able to access it at https://DNS/app_name/ in the browser. This container connects to a custom network(driver=bridge) created while starting the container with docker-compose command.

Then I created a container out of a docker image with docker run -d -p <port_mapping> <image_name> command. This container connects to the default bridge network(driver=bridge).

But after 2nd container starts I cannot access 1st container at https://<DNS>/app_name/ anymore. Whereas I can access the 2nd container in the browser by hitting the URL http://localhost:<port>/appname.

If I restart the docker(in docker-for-desktop) the 2nd container does not come up(as I have to start it by docker start command) but I am able to access the 1st container.

docker-for-desktop version is 3.3.1 on macOS Big Sur. The above setup was working perfectly fine on macOS Catalina.

To cut short: I cannot access 1st container when 2nd one is up. My requirement is to run both containers simultaneously.

Can someone help with this?

are they both listning on port 80 & 443 or?
if so, you need something in front to loadbalance/proxy

The 1st container is listening on 443 and the 2nd one is listening on 8643. I read that using proxy will help but this setup was working earlier on macOS Catalina.

Aside: I have edited your first post to use Markdown `code` rather than Markdown **emphasis**. This ensures that things that look like HTML tags are not hidden by the browser, like the <DNS> in your https://<DNS>/app_name/ (which rendered as https:///app_name/) or the <port> in your http://localhost:<port>/appname (which rendered as http://localhost:/appname).

Please validate if all information is complete and correct.