Docker Community Forums

Share and learn in the Docker community.

Port-mapping to public ip in docker

Hi everyone,
I login to a server with public id is: 20.211.188.23
I try to run a image nginx with port-maping to public id and port is 1234, but i had an error below:

Someone can fix this, tkanks you!

Hello and welcome,

I have checked your command and on my computer it is working as expected. Of course I have used an IP-address on my computer to bind to (docker run -d -p 192.168.0.236:1234:80 nginx:latest).
Are you sure that the ip address in your command is bound to an interface on your computer? You can check with ip -a which interface uses which ip-address.
In addition please ensure that no other service is already using port 1234 globally or on that interface. You can check with sudo netstat -tulpn | grep ":1234"

else you can try to use 0.0.0.0 as IP, as it will bind to all ips