docker-mac-network
docker-mac-network copied to clipboard
Make network and netmask configurable via environment parameter
This will enable the setup to have different networks and netmasks being used.
One example for setting up a aka cluster with own IP network/netmask:
version: '2'
services:
seed:
image: mhamrah/clustering:0.3
ports:
- '1600:1600'
environment:
CLUSTER_PORT: 1600
# CLUSTER_IP: seed
SEED_PORT_1600_TCP_ADDR: 100.64.1.10
HOST: seed
networks:
backend:
ipv4_address: 100.64.1.10
c1:
image: mhamrah/clustering:0.3
ports:
- '1601:1601'
environment:
CLUSTER_PORT: 1601
# CLUSTER_IP: 100.64.1.11
SEED_PORT_1600_TCP_ADDR: 100.64.1.10
HOST: c1
networks:
backend:
ipv4_address: 100.64.1.11
c2:
image: mhamrah/clustering:0.3
ports:
- '1602:1602'
environment:
CLUSTER_PORT: 1602
# CLUSTER_IP: 100.64.1.12
SEED_PORT_1600_TCP_ADDR: 100.64.1.10
HOST: c2
networks:
backend:
ipv4_address: 100.64.1.12
proxy:
image: tkaefer/docker-mac-network
ports:
- "127.0.0.1:13194:13194"
command: TCP-LISTEN:13194,fork TCP:100.64.1.20:1194
networks:
backend:
openvpn:
image: kylemanna/openvpn
volumes:
- ./config:/etc/openvpn
- ./local:/local
cap_add:
- NET_ADMIN
environment:
dest: akka-mac-docker.ovpn
DEBUG: '1'
DOCKER_NETWORK: 100.64.1.0
DOCKER_NETMASK: 255.255.255.192
command: /local/helpers/run.sh
networks:
backend:
ipv4_address: 100.64.1.20
networks:
backend:
driver: bridge
ipam:
driver: default
config:
- subnet: 100.64.1.0/26
gateway: 100.64.1.1
The environment variables exposed as:
DOCKER_NETWORK: 100.64.1.0
DOCKER_NETMASK: 255.255.255.192
will ensure the right routing in the OpenVPN client config file.
@tkaefer Sorry for the late response. Merging, thanks!