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

Implemented Multi docker network and connection #51

Merged

Conversation

kforeverisback
Copy link
Contributor

@kforeverisback kforeverisback commented May 11, 2023

What

Implements Multi-Network mode in docker-compose.

Closes

Fixes #44

Tests

Tested multi-network using the following docker-compose.yaml

version: '3.9'

networks:
  nginx_net:
    driver: bridge
    name: nginx_net
    ipam:
      config:
        - subnet: 172.84.0.0/16
          gateway: 172.84.0.1
  k3d-ext: # Test an external network
    name: k3d
    external: true

services:
  nginx:
    container_name: nginx
    image: nginx:latest
    ports:
      - 8800:80
      - 2120:8000
    networks:
      - nginx_net
      - k3d-ext
    labels:
      - "UFW_MANAGED=TRUE"

Sample Log from systemd

May 10 18:33:03 chromebox ufw-docker-automated[11836]: 2023-05-10T18:33:03-07:00 INF main.go:18 > ufw-docker-automated: Connected to the Docker Engine.
May 10 18:33:41 chromebox ufw-docker-automated[11836]: 2023-05-10T18:33:41-07:00 INF create.go:91 > ufw-docker-automated: Adding inbound rule: /usr/bin/sudo ufw route allow proto tcp from 10.110.210.179 to 192.168.151.3 port 80 comment traefik:e2dbe6de65a2
May 10 18:33:41 chromebox ufw-docker-automated[11836]: 2023-05-10T18:33:41-07:00 INF create.go:96 > ufw cmd (network: socket_proxy): /usr/bin/sudo ufw route allow proto tcp from 10.110.210.179 to 192.168.151.3 port 80 comment traefik:e2dbe6de65a2
May 10 18:33:41 chromebox ufw-docker-automated[11836]: 2023-05-10T18:33:41-07:00 INF create.go:91 > ufw-docker-automated: Adding inbound rule: /usr/bin/sudo ufw route allow proto tcp from 10.110.210.179 to 192.168.150.2 port 80 comment traefik:e2dbe6de65a2
May 10 18:33:41 chromebox ufw-docker-automated[11836]: 2023-05-10T18:33:41-07:00 INF create.go:96 > ufw cmd (network: t2_proxy): /usr/bin/sudo ufw route allow proto tcp from 10.110.210.179 to 192.168.150.2 port 80 comment traefik:e2dbe6de65a2

@kforeverisback
Copy link
Contributor Author

@shinebayar-g

@shinebayar-g
Copy link
Owner

shinebayar-g commented May 11, 2023

Hi @kforeverisback , thanks for the PR. I'll take a look at it this weekend.

@shinebayar-g shinebayar-g merged commit 5adab61 into shinebayar-g:main May 30, 2023
@shinebayar-g
Copy link
Owner

Thank you so much for the contribution @kforeverisback

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.

When container has multiple networks, it only creates one network rules
2 participants