Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

How to allow custom docker network to have connection to LAN devices

I'm running into problems with docker-compose. I need a 2-way connection between two containers so I am unable to use the link functionality. I read instead about using a network with aliases and this works really great between the two containers, but I am noticing now that the containers cannot ping a piece of physical hardware that's on my LAN along with the computer that is running docker-compose. (192.168.1.208).

How can I edit the main network so that it can access my 192.168.1.1 but that the aliases are also in so that the two containers can talk to each other? Thanks!

version: '3'
services:
  zc1:
    container_name: zc1
    networks:
      main:
        aliases:
          - zc1
    build:
      context: .
      dockerfile: Dockerfile

  dc:
    container_name: dc
    build:
      context: .
      dockerfile: Dockerfile
    networks:
      main:
        aliases:
          - dc
networks:
  main:

Comments