-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Docker Macvlan network documentation
- Loading branch information
Showing
2 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
--- | ||
title: "Docker Macvlan" | ||
description: "Use Docker Macvlan for a dedicated IP" | ||
bookCollapseSection: true | ||
headless: true | ||
--- | ||
# Docker Macvlan Setup | ||
|
||
## Prerequisites | ||
|
||
Make sure, you have an IP address in your network, which does not get served by the local DHCP server. | ||
|
||
## Assumptions for this example | ||
|
||
In this example | ||
|
||
* the IP address 192.168.1.3 is reserved for teddycloud | ||
* in a network 192.168.0.0/23 | ||
* with the router having the address 192.168.0.1 | ||
|
||
|
||
## Create Docker Macvlan Network | ||
|
||
You create a Docker Macvlan network with the following command: | ||
|
||
``` | ||
docker network create \ | ||
--driver macvlan \ | ||
--subnet=192.168.0.0/23 \ | ||
--gateway=192.168.0.1 \ | ||
--ip-range=192.168.1.3/32 \ | ||
-o parent=eth1 \ | ||
teddycloud_macvlan | ||
``` | ||
|
||
Of course you have to adapt all the parameters to your network. | ||
|
||
## Adjust docker-compose.yaml | ||
|
||
After the Docker Macvlan network has been created, it can be used in the `docker-compose.yaml`. | ||
|
||
### Add Docker Macvlan network | ||
|
||
At the end of you `docker-compose.yaml` add the following lines to add the Docker Macvlan network: | ||
|
||
``` | ||
networks: | ||
teddycloud_macvlan: | ||
external: true | ||
``` | ||
|
||
### Use Docker Macvlan in teddycloud service | ||
|
||
Add the networks secion to your teddycloud service, which are the last three lines of the following snippet | ||
|
||
``` | ||
services: | ||
teddycloud: | ||
… | ||
networks: | ||
teddycloud_macvlan: | ||
ipv4_address: 192.168.1.3 | ||
``` | ||
|
||
## Done | ||
|
||
Save the `docker-compose.yaml` file and start the container. | ||
|