I use docker-compose to charge my container, I need to connect between container and host, so I need an ip that I always could access, I know docker's default ip on linux is 172.17.0.x
, but something strange is that every time I start up the container the ip will change, from 172.18.0.1
to 172.19.0.1
to 172.20.0.1
and etc ..., step by step
Asked
Active
Viewed 599 times
0

afraid.jpg
- 965
- 2
- 14
- 31
-
Instead of relying on the ip address, what about just using port forwarding to expose the service you need to access on the host? – larsks Jan 06 '20 at 03:48
-
Does this answer your question? [Assign static IP to Docker container](https://stackoverflow.com/questions/27937185/assign-static-ip-to-docker-container) – afraid.jpg Jan 06 '20 at 06:46