0

I need to implement solution when there are DB and Data Processor. Both are on separated containers. Those containers are on another container "Docker 1". I need to run multiple times this last container "Docker 1", "Docker 2"... It could be complicated so there is a image architecture

There is Docker file to run DB and Data processor:

version: '3'
services:
    db:
        image: "..."
        ports:
            - "1521"
        networks:
            default:
                aliases:
                    - oracle
        volumes:
            - "/var/run/docker.sock:/var/run/docker.sock"
    data_processor:
        image: "..."
        ports:
            - "8321"
            - "6003"
        networks:
            default:
                aliases:
                    - processor
        privileged: true
        user: root
        volumes:
            - "/var/run/docker.sock:/var/run/docker.sock"
        command: tail -f /dev/null

and docker file to run multiple dockers:

version: '3'

services:
  docker1:
    image: ...
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
    command: tail -f /dev/null
    user: root

  docker2:
    image: ...
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
    dns:
    command: tail -f /dev/null
    user: root

  ....
  dockerx:
    ....

I am getting IP and mapped DB port by command:

docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'

The problem is that Data Processor cannot connect ro DB by using those IP:Port. Where is the problem?

j3094531
  • 13
  • 5
  • The Docker-private IP addresses don't work in a wide variety of common situations; I'd never bother looking them up. Are all of these Compose files (not Dockerfiles) running on the same system? Do you have a specific call between containers that's failing, and a specific error message it produces? – David Maze Jul 13 '20 at 20:36
  • @DavidMaze, Data Processor has Oracle client and this client cannot connect to DB. How should I connect from one docker to anoter? – j3094531 Jul 14 '20 at 07:47
  • I might start reading [Networking in Compose](https://docs.docker.com/compose/networking/) which describes the basic mechanisms for connecting between _containers_. If you're trying to connect between different _Compose files_, on the same host, on the same _Docker (daemon)_, questions like [Communication between multiple docker-compose projects](https://stackoverflow.com/q/38088279/10008173) address this. – David Maze Jul 14 '20 at 10:30

0 Answers0