Docker Community Forums

Share and learn in the Docker community.

How to use dockerized server with non-docker client on the same host and port

Hi,

I have a java client running on my localhost on port 4334.
I have docker installed and when I try to run my server docker on the same host:

docker run  -it --name $DOCKER_NAME_REF  -p 4334:4334

I get this error message:
C:/Program Files/Docker/Docker/Resources/bin/docker.exe: Error response from daemon: driver failed programming external connectivity on endpoint netopeer2 (9274c38bc0c671ecbaacc154b57d1a345e8a796263368661d668c6c0782a0fed): Error st
arting userland proxy: Bind for 0.0.0.0:4334: unexpected error Permission denied.

I understand that both servers with same ip cannot run on the same port. It there a simple way, I am not a docker expert, to have a separate ip for one of them but that they can still communicate on the same port?

I need you docker experts advice.

br,

//mike

A port for an ip can only be bound by one process, regardless wether its a native host process or a containerized process.

yes but is there a way to create separate ip addresses for my containerizes server and the client I have running docker?

Open Oracle VM VirtualBox Manager.
Select the VM used by Docker.
Click Settings -> Network.
Adapter 1 should (default?) be “Attached to: NAT”
Click Advanced -> Port Forwarding.
Add rule: Protocol TCP, Host Port 8080, Guest Port 8080 (leave Host IP and Guest IP empty)
Guest is your docker container and Host is your machine.

1 Like