I've set up a server on a remote Linux machine on the same network. I can access this server from my mac computer with private IP http://172.30.1.50/.

However, when I try to access this address within my docker container with the following settings it did not work. I found that network_mode: host could help this problem but it does not work in docker for mac.

version: '3.7'
services:
  external_admin:
    image: external_admin
    build:
      context: ./external_admin/
    working_dir: /usr/src/app
    ports:
      - "5000:5000"
    volumes:
      - ./external_admin:/usr/src/app
    command: python manage.py run -h 0.0.0.0 -p 5000
    env_file:
      - ./env_files/external_admin.dev.env
    networks:
      - backend
networks:
  backend:

Is there any way to enable private networking within this docker-compose file?

0

There are 0 best solutions below