Answer the question
In order to leave comments, you need to log in
How to assign an IP (hostname) to a Docker container?
How to assign an IP to a container so that it can be accessed from the host system (mac, Docker for mac)?
When trying to do something like
docker run --name postgres -d -p 172.17.42.1:5432:5432 postgres
Answer the question
In order to leave comments, you need to log in
Good time. Faced the same problem. I would like to share the solution to this problem.
1. Disable virtualization of TCP IP protocols in Chios (not the fact that this is the case), but I enabled this option.
2. No need to write 172/17/42/1:5432 write 127/0/0/1:5432 but this is on docker release 2/20. On release 1/19, this method does not work and a crutch is needed in the form of iptables example 192/168/1/102:5432 since I use a router and set up the following table. The nat_wormations section under the virtuls_servise menu forwards ports to the IP we need (I repeat docker platforms 1/19), this scheme will not work on platform 2/20. This bug has been fixed in platform 2/20.
Good luck to all.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question