Mapping container's ip to host ip

I am running a service in scala that is mapped to a docker container’s ip .now I want to acces this service from outer world . so how do I need to map the container’s ip to host ip.?

No, you should just expose/map your container port to your host port.

docker run -d -P yourImage # The -P map the container port to a random host port
docker run -d -p "1234:4567" yourImage # Map the host port 1234 to the container port 4567

The documentation : https://docs.docker.com/reference/run/#expose-incoming-ports

Thank u :smile:later I realised. It was some error on my part. Thanks again :slight_smile:

I have same question but in my case I want to access a TCP Socket Server service running on my host PC, and I want to access this service from docker container.
Inside the container I am running the TCP Socket Client code…
(I am using docker for windows, and container is running in Linux mode).