Docker Community Forums

Share and learn in the Docker community.

Docker-compose with a VPN-Client and a bunch of services

Moin,
I used to use a single docker image with a VPN Client (xl2tp) and a mqtt-Server and an Apache. So it was possible to access these two ports through the VPN. Important: The services may only be accessible in the VPN, not from the computer running Docker. A single container is ugly, but it worked.

Now more services/ports should be added. That’s why I want to use individual containers and docker-compose.

version: '3.7'

services:

  httpd:
    build: 
     dockerfile: Dockerfile
     context: ./httpd
    ports:
      - "80:80"
    depends_on:
      - l2tp 
    networks:
      - hamnet

  hivemq:
    build: 
     dockerfile: Dockerfile
     context: ./hivemq
    ports:
      - "1833:1833"
      - "8000:8000"
    depends_on:
     - l2tp 
    networks:
      - hamnet

  l2tp:
    cap_add:
      - NET_ADMIN
    build: 
     dockerfile: Dockerfile
     context: ./l2tp
    privileged: true
    networks:
      - hamnet

networks:
  hamnet:
    name: hamnet
    external: true

The whole thing comes up. The VPN IP can be pinged, the ports are accessable from inside the containers, but the ports (http, mqtt etc) are not reachable via the VPN.

What do I have to do to bring http and mqtt into the VPN?

Grateful for hints