0

I'm using Docker compose to set up a local development environment on Mac. I want to be able to connect to the container from the LAN (for ex, from my phone or iPad) by using a static IP, and to configure it in the docker-compose file. Is it possible?

Vladimir Mikhaylovskiy
  • 1,635
  • 4
  • 17
  • 26

2 Answers2

0

I'm pretty sure this post has what you're looking for: Assign static IP to Docker container

In docker-compose, you can build out networks and attach those containers to the network, which will allow you to simulate exactly what's being noted in the above post:

https://docs.docker.com/compose/networking/#specify-custom-networks

https://docs.docker.com/compose/compose-file/compose-file-v2/#ipv4_address-ipv6_address

Patrick
  • 2,407
  • 1
  • 13
  • 20
-1

In most cases a static IP wouldn’t be necessary if you expose the ports from the container to your Mac. You could reach your container by going to http://localhost:80 for example. You can specify this in your composefile.

Esra
  • 762
  • 6
  • 5