Docker Community Forums

Share and learn in the Docker community.

Connecting To Container From Outside Host

(Kkhosla) #1

Issue: Cannot access container via IP from a second device.

My goal is to run an application from inside a container as a server, and use external devices as clients. I currently have a bridge network set up with a range of IP adresses, a gateway, and a subnet. When a container is created on the network, it gets a dynamically allocated IP from the IP range on the network. How can I access the container with the IP address from my clients?

Edit: Additional information. I can ping from the container to both host and a client, I can ping from the host to both client and container, but I can only ping to host from client. I cannot ping from client directly to container.

I’m running Docker 3.11 on Linux.

(Victor Peng) #2

Where is your client? Is it in another container? Is the other container in the same network as your server container?

(Kkhosla) #3

My client is not on another container, but it is on the same network as the server container.

(Kkhosla) #4

Additional information.

Network creation command: docker network create -d bridge --gateway= --subnet --ip-range my_network

Container creation: docker run -itd --privileged --memory=“32g” --cpuset-cpus x-y -p 7000:7000 -p 7001:7001 -p 7199:7199 -p 9042:9042 -p 9160:9160 --net=my_network --ip=“” -v /drive/location:/var/lib/cassandra --name=c2 cassandra:latest

(Sysic) #5

how about making proxy-lb?