Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Network Docker-Compose

I have a docker-compose with a bridge network called mdb_default, where I have a database.

I want to deploy another docker-compose that connects to that network that already exists, but I don’t know how to define it in the docker-compose.
My file is:

supeset:
    container_name: superset
    build: .
    restart: always
    depends_on:
      - mariadb
    environment:
      MAPBOX_API_KEY: 'pk.eyJ1IjoiamFta2lsbHM1IiwiYSI6ImNrd293aDJyZjA3MGQyd3AzdTJpeXp0dTAifQ.w96chqjB6Nv3PW6_lpQVHQ'
    ports:
      - 8000:8088
    volumes:
      - ./superset-data:/var/lib/mysql
    networks:
      - mdb_defatult
networks:
  mdb_dafault:
    driver: bridge 

What do I need to do to connect to this existing network?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

The network information is that I want to connect both is:

        "Name": "mdb_default",
        "Id": "2c69ba9fb42c1d9ca6142ae49c403d44bae5e297b78f4339c4782d3658f3d49c",
        "Created": "2022-05-17T14:17:47.935473033Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "172.20.0.0/16",
                    "Gateway": "172.20.0.1"

>Solution :

As described here: https://docs.docker.com/compose/networking/#use-a-pre-existing-network

Try:

supeset:
    container_name: superset
    build: .
    restart: always
    depends_on:
      - mariadb
    environment:
      MAPBOX_API_KEY: 'pk.eyJ1IjoiamFta2lsbHM1IiwiYSI6ImNrd293aDJyZjA3MGQyd3AzdTJpeXp0dTAifQ.w96chqjB6Nv3PW6_lpQVHQ'
    ports:
      - 8000:8088
    volumes:
      - ./superset-data:/var/lib/mysql
    networks:
      - mdb
networks:
  mdb:
    external:
      name: mdb_default
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading