Connect to LAN database

Asked

Viewed 61 times

-1

I have the following network:

Standard gateway -> 192.168.1.1

Host -> 192.168.1.2

Database (Mysql) -> 192.168.1.3

I generated a container using Docker-Compose.yml with the following configuration

version: '3.3'
services:
  php53:
    image: bylexus/apache-php53
    container_name: php53
    volumes:
      - ./www:/var/www
    ports:
      - 80:80
    network_mode: bridge  

I would like the applications inside my container to access the bank of my local network: 192.168.1.3. When giving docker container inspect php53, he brings the Gateway: 172.17.0.1

1 answer

0

As his db already exists at the given address 192.168.1.3, and its purpose is to access this base from within the container just change the line

network_mode: bridge for network_mode: host.

source: Igor Devops

Browser other questions tagged

You are not signed in. Login or sign up in order to post.