Docker for Windows newbie here.
I need one of the containers to reach a web server located in one of the machines of the same LAN (192.168.1.134) where the host machine resides (192.168.1.100), but I don't understand how to do it.
Containers are started via docker-compose, with a configuration like this :
version: '3.2'
services:
myapp:
image: 'docker.io/bitnami/codeigniter:latest'
ports:
- '8000:8000'
volumes:
- '.:/app'
depends_on:
- mariadb
mariadb:
volumes:
- ./docker_data:/docker-entrypoint-initdb.d
image: 'docker.io/bitnami/mariadb:10.3-debian-10'
ports:
- '3306:3306'
environment:
MARIADB_ROOT_PASSWORD: xxx
MARIADB_DATABASE: xxx
MARIADB_USER: xxx
MARIADB_PASSWORD: xxx
composer_installation:
container_name: composer_installation
image: composer
volumes:
- ./:/app
command: composer install --ignore-platform-reqs
Containers can ping each other and I have outbound/inbound internet connectivity inside the containers, but I can't reach IPs in my LAN
I tried modifying docker-compose by adding
--extra_hosts:
- "myotherhost:192.68.1.134"
to "myapp" container - I can see host added to /etc/hosts file, but I have no outbound connectivity.
I also tried to add network_mode: bridge , to every container configuration , but this way I lose communication between containers.