Docker Community Forums

Share and learn in the Docker community.

Configuring problem network host

Hello,

I’m using the docker-compose command to build two containers and run it. I use a mysql and an apache image. I want to run it as host network. On my computer it works very well. My college uses docker toolbox and he has some troubles. The mysql and apache server is not reachable by localhost. It is only reachable by a created ip address, which is assigned from docker. Why is it so? How can I configure the yml, that the host network is used by the two containers.

The configuration files looks like:
version: ‘3’

services:
db:
image: mysql:5.7
container_name: mysql
ports:
- “3306:3306”
web:
build: ./php/
container_name: php_web
depends_on:
- db
ports:
- “8500:80”
stdin_open: true
tty: true
networks:
app-network:
external: true

Shut down your virtual machine. In Workstation, go to VM > Settings > Network Adapter. Ensure that the network adapter is connected (that is, the Connected and Connect at power on options are selected). Ensure that the network adapter is configured for NAT or Bridged, and not Host Only.