Last active
September 23, 2023 01:38
-
-
Save eerotal/56ef92d733fd6ce8b6f0deda5fe7f49f to your computer and use it in GitHub Desktop.
Docker Swarm service with a macvlan network
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Set network interfaces on all worker nodes to promiscuous mode. | |
| # Run on all worker nodes: | |
| ip link set <bridged interface> promisc on | |
| # Create a config-only network for each worker node. | |
| # This defines the host-specific network configurations. | |
| # Run on all worker nodes: | |
| docker network create \ | |
| --config-only \ | |
| -d macvlan \ | |
| --subnet 192.168.0.0/24 \ | |
| --gateway 192.168.0.1 \ | |
| -o parent=<bridged interface> \ | |
| macvlan-cfg | |
| # Create the macvlan network in the Swarm cluster. | |
| # Run on manager node: | |
| docker network create \ | |
| --scope swarm \ | |
| --config-from macvlan-cfg \ | |
| -d macvlan \ | |
| macvlan | |
| # Start a service attached to the macvlan network. | |
| docker service create \ | |
| --replicas 1 \ | |
| --network macvlan \ | |
| nginx | |
| Resources: | |
| - https://collabnix.com/docker-17-06-swarm-mode-now-with-macvlan-support/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment