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,955
  • 4
  • 19
  • 28

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,885
  • 1
  • 14
  • 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
  • 1,062
  • 8
  • 5