Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

raison

macrumors member
Original poster
Nov 13, 2009
83
4
I'm using Catalina 10.15.7 (19H114). I have a Linux box connected to the same router my Macbook is connected to. Their IP addresses is on the 192.168.1.0 network.
My Linux box has a few Docker containers running on a private 192.168.33.0 network. I want my Mac to be able to connect to that Linux network.

How can I accomplish that?

My vague understanding of how IP routing works tells me that I have to add a route on my Mac such as:
network: 192.168.33.0
netmask: 255.255.255.0
gateway: my linux IP address

Do I have to use the route command on my Mac, or is there anything else I can use - preferably a GUI tool maybe? Also, do I need to change anything on my Linux box to allow outside connections to its Docker containers?
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
What type of Docker network is it? Do you really want the containers on a “private” network or do you really want them on your main network? Have you exposed the ports you want in the Docker containers?
 

raison

macrumors member
Original poster
Nov 13, 2009
83
4
I could place them in the main network I guess, I'm not sure how to though. If I use the main network to start the containers, docker-compose fails.
This is how the docker-compose network is being defined:

Code:
networks:
  front:
    ipam:
      driver: default
      config:
          - subnet: 192.168.33.0/16
            gateway: 192.168.33.1

If I change from 192.168.33.0 to 192.168.1.0, docker fails with:

Code:
ERROR: for rkcore_db_1  Cannot start service db: network 752074a9279bff5e16b998255cc7a83aa73ee17d8745d04ce51df168de168cfa not Starting rkcore_smtp_1          ... error

ERROR: for rkcore_smtp_1  Cannot start service smtp: network 752074a9279bff5e16b998255cc7a83aa73ee17d8745d04ce51df168de168cfa not found
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
The default driver is bridge. You cannot bridge the same network to the same network. If you use the macvlan driver you can have the containers on the main network (assign them static IP addresses of you can)
 

raison

macrumors member
Original poster
Nov 13, 2009
83
4
Thank you.

I tried with macvlan and worked.

I'd still like to know if it's possible to have the bridge network available to another machine so I don't have to specify what device to use on my docker-compose which is required for the macvlan driver. Is this possible with IP routing, or not at all?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.