Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make network and netmask configurable via environment parameter #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tkaefer
Copy link

@tkaefer tkaefer commented Nov 9, 2016

This will enable the setup to have different networks and netmasks being used.

@tkaefer
Copy link
Author

tkaefer commented Nov 9, 2016

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.

@wojas
Copy link
Owner

wojas commented Jan 31, 2017

@tkaefer Sorry for the late response. Merging, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants