I have a Windows 7 machine with an Ubuntu VM created through VirtualBox. Within this Ubuntu VM I have docker and docker-compose installed. Version info below:
Host OS: Windows 7 Enterprise
VirtualBox: version 5.2.12
Guest OS: Ubuntu version 18.04
docker: version 18.05.0-ce, build f150324
docker-compose: version 1.21.2, build a133471
My Windows 7 machine has Cisco AnyConnect installed which is used to connect to our VPN, because our app needs resources located within this network. The Ubuntu VM can see the VPN (and resolve URLs in this network) but the docker containers created within the VM cannot. I was able to partially get around this issue by passing --network host
to our docker build
commands. This binded the containers to the host network (the Ubuntu VMâs network) which allowed the containers to access resources within the VPN.
Now, my issue: We use a docker compose file on our project. The --network host
option cannot be passed to our docker-compose build
commands, but must instead be specified in the docker compose file with network_mode: host
. Unfortunately, this is not working as expected. I have tried both network_mode: host
and network_mode: "host"
, but no luck.
It seems other docker compose users are having the same issue. See here and here.
I have also tried using the hostâs networking stack, but no luck. This change likely didnât work because of following line in the docs:
Only used if you use
docker stack
commands. If you use thedocker-compose
command, use network_mode instead.
For reference, here is our docker-compose.yml
file:
version: '3.4'
services:
mssql:
network_mode: host
build:
context: ./compose/mssql
dockerfile: ./Dockerfile
environment:
ACCEPT_EULA: 'Y'
env_file:
- .env
ports:
- 1433:1433
selfcheckui:
network_mode: host
build:
context: .
dockerfile: ./Dockerfile-myeverify-selfcheckui
ports:
- 8004:8080
environment:
SPRING_PROFILES_ACTIVE: compose
depends_on:
- mssql
env_file:
- .env
- proxy.env
If you know of workaround(s) to this issue, any help is appreciated.