Skip to content

Instantly share code, notes, and snippets.

@tonyklawrence
Last active August 26, 2019 07:08
Show Gist options
  • Save tonyklawrence/5a1ca405008ee2cb3be022be77a2629c to your computer and use it in GitHub Desktop.
Save tonyklawrence/5a1ca405008ee2cb3be022be77a2629c to your computer and use it in GitHub Desktop.
Docker Compose Example
version: '2'
services:
first:
...
mac_address: d0:ca:4a:99:02:00
networks:
some_network_name:
ipv4_address: 192.168.1.200
second:
...
mac_address: d0:ca:4a:99:02:01
networks:
some_network_name:
ipv4_address: 192.168.1.201
third:
...
mac_address: d0:ca:4a:99:02:02
networks:
some_network_name:
ipv4_address: 192.168.1.202
networks:
some_network_name:
driver: macvlan
driver_opts:
parent: eth0
ipam:
config:
- subnet: 192.168.1.0/24
gateway: 192.168.1.1
ip_range: 192.168.1.200/28
@tonyklawrence
Copy link
Author

This is an example docker compose file which has multiple services using pre-defined unique MAC and IP addresses but sharing the macvlan network.

@jult
Copy link

jult commented Jan 25, 2019

Do you know if there is added latency when comparing macvlan network traffic with 'direct to NIC' inside a docker 'host'?

Never mind, found the answer; https://esc.fnwi.uva.nl/thesis/centraal/files/f345928229.pdf TL;DR TCP-IP is even faster than VM and direct to NIC network traffic, UDP is significantly slower than both. Which begs the question if you should use macvlan for (UDP) DNS queries..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment