Network param for connecting to in container

I am running an app in my container that provides console access from port 9000. To access within the container I type “telnet 9000” and it works fine.
I understand that I need to expose the port but whats the method to pair the external address with the internal localhost address ?

Read about the EXPOSE command or -p runtime option.

Right, and if we further RTFM the question is not asking to expose the port but to provide address mapping to the internal IP address of, which is not bound to the network container, AFAIK. shows an example of mapping the localhost, or address from the docker HOST, for example

$ docker run -d -p training/webapp python,

and my question is, based on testing is:

Is there a way to specify -p HostPort:ContainerIP:ContainerPort?
The error issued when attempted seems to show that the format is only from the host side of IP:HostPort:ContainerPort.

I just tried, I don’t think you can expose loopback, you are going to need to expose your service on eth0

Hi Craig,
Did you manage to do it?
I thought about port forwarding inside Docker, but I can’t manage to do it…

I finally found a way to do it.
You can use socat like this:
socat -d tcp-listen:1234,reuseaddr,fork tcp: &

As you guess, 1234 is the port you want to expose to the outside world and 6789 is your internal port listening on localhost only.