0

I have a docker-compose setup which looks like this:

version: "3"
services:
  client1:
    cap_add:
     - NET_ADMIN
    image: "client:testing"
    container_name: "client1"
    privileged: true
    tty: true
    networks:
      nwclient1: {}
    volumes:
     - ./../:/config
    command: ping server
  client2:
    cap_add:
     - NET_ADMIN
    image: "client:testing"
    container_name: "client2"
    privileged: true
    tty: true
    networks:
      nwclient2: {}
    volumes:
     - ./../:/config
    command: ping server
networks:
  nwclient1:
    internal: true
  nwclient2:
    internal: true

I want to have those two containers being able to ping the server (which is reachable from the docker host) but keeping them in different subnets so that no communication between them is possible.

How can I achieve this? I experimented with some route add commands on the host but to no avail. Maybe the solution is simpler and integrated into docker.

Thanks in advance

1 Answers1

0

Solution was so simple. I only had to remove the option "internal". The containers are still isolated from each other which I did not expect to be by default!