I'm running ubuntu desktop in a virtual box (my host is mac), and inside this virtual machine I'm experimenting with macvlan
docker network driver with docker-compose.
Here's my docker-compose.yml
file:
version: '3.7'
services:
trader:
build: ./
image: giuliotrader
container_name: giuliotrader
networks:
trading:
ipv4_address: 172.16.86.33
depends_on:
- tws
tws:
build: ./ib-docker
image: ibconnect
container_name: ibconnect
ports:
- "4001:4001"
- "4003:4003"
- "5901:5901"
volumes:
- ./ib-docker/config.ini:/root/ibc/config.ini
- ./ib-docker/gatewaystart.sh:/opt/ibc/gatewaystart.sh
networks:
trading:
ipv4_address: 172.16.86.22
networks:
trading:
driver: macvlan
driver_opts:
parent: enp0s3.10
ipam:
config:
- subnet: 172.16.86.0/24
#gateway: 172.16.86.1
I'm having troubles with these two containers to access the internet.
I can access the machines via docker exec -it ibconnect /bin/bash
, but there's no way they can access the network, if I apt-get install iputils-ping
I get:
Temporary failure resolving 'archive.ubuntu.com'
and if I nc -l 5047
on one container and nc 172.16.86.22 5047
on the other I get Connection refused
.
If I uncomment the last line (gateway
) docker-compose reports an error:
ERROR: The Compose file './docker-compose.yml' is invalid because:
networks.trading.ipam.config value Additional properties are not allowed ('gateway' was unexpected),
I'm not sure what I'm missing in the configuration for configuring the gateway. How can I properly configure the network in this setup? I couldn't find any decent documentation.
Thanks,