revision
This commit is contained in:
18
LICENSE
18
LICENSE
@@ -1,9 +1,9 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) <year> <copyright holders>
|
Copyright (c) <year> <copyright holders>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|||||||
214
README.md
214
README.md
@@ -1,107 +1,107 @@
|
|||||||
# docker
|
# docker
|
||||||
|
|
||||||
[TOC]
|
[TOC]
|
||||||
|
|
||||||
## Volumes
|
## Volumes
|
||||||
|
|
||||||
### NFS
|
### NFS
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
|
|
||||||
|
|
||||||
docker-compose.yaml
|
docker-compose.yaml
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
volumes:
|
volumes:
|
||||||
volume00:
|
volume00:
|
||||||
driver: local
|
driver: local
|
||||||
driver_opts:
|
driver_opts:
|
||||||
type: ${VOLUME_TYPE}
|
type: ${VOLUME_TYPE}
|
||||||
o: ${VOLUME_O}
|
o: ${VOLUME_O}
|
||||||
device: "${VOLUME_DEVICE}"
|
device: "${VOLUME_DEVICE}"
|
||||||
```
|
```
|
||||||
|
|
||||||
.env
|
.env
|
||||||
|
|
||||||
```text
|
```text
|
||||||
VOLUME_TYPE="nfs"
|
VOLUME_TYPE="nfs"
|
||||||
|
|
||||||
# DNS server ip, RW:read and write
|
# DNS server ip, RW:read and write
|
||||||
VOLUME_O="addr=10.10.1.1,rw"
|
VOLUME_O="addr=10.10.1.1,rw"
|
||||||
|
|
||||||
# Folder on NFS Server
|
# Folder on NFS Server
|
||||||
## Must exists on nfs server, or security errors when starting container
|
## Must exists on nfs server, or security errors when starting container
|
||||||
VOLUME_DEVICE=":/export/docker-volumes/volume00"
|
VOLUME_DEVICE=":/export/docker-volumes/volume00"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Network
|
## Network
|
||||||
|
|
||||||
### Macvlan
|
### Macvlan
|
||||||
|
|
||||||
#### Create
|
#### Create
|
||||||
|
|
||||||
How to create a docker macvlan network
|
How to create a docker macvlan network
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# run on host
|
# run on host
|
||||||
docker network create -d macvlan --subnet=192.168.1.249/24 --gateway=192.168.1.1 -o parent=eth0 macvlan_network
|
docker network create -d macvlan --subnet=192.168.1.249/24 --gateway=192.168.1.1 -o parent=eth0 macvlan_network
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Host comunication
|
#### Host comunication
|
||||||
|
|
||||||
if network required between host and docker container on a macvlan docker network
|
if network required between host and docker container on a macvlan docker network
|
||||||
|
|
||||||
* Option 1 - Create another macvlan on host
|
* Option 1 - Create another macvlan on host
|
||||||
|
|
||||||
* Setup vars
|
* Setup vars
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
MACVLAN_NAME=macvlan_bridge
|
MACVLAN_NAME=macvlan_bridge
|
||||||
HOST_ETHERNET_ADP=eth0
|
HOST_ETHERNET_ADP=eth0
|
||||||
NETWORK=192.168.1.0/24
|
NETWORK=192.168.1.0/24
|
||||||
```
|
```
|
||||||
|
|
||||||
* Create mavclan adapter
|
* Create mavclan adapter
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
ip link add $MACVLAN_NAME link $HOST_ETHERNET_ADP type macvlan mode bridge
|
ip link add $MACVLAN_NAME link $HOST_ETHERNET_ADP type macvlan mode bridge
|
||||||
ip addr add $NETWORK dev $MACVLAN_NAME
|
ip addr add $NETWORK dev $MACVLAN_NAME
|
||||||
ifconfig $MACVLAN_NAME up
|
ifconfig $MACVLAN_NAME up
|
||||||
```
|
```
|
||||||
|
|
||||||
* Add routing
|
* Add routing
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
ip route add $CONTAINER_MAVLAN_IP dev $MACVLAN_NAME
|
ip route add $CONTAINER_MAVLAN_IP dev $MACVLAN_NAME
|
||||||
```
|
```
|
||||||
|
|
||||||
* Delete mavclan adapter
|
* Delete mavclan adapter
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
ifconfig $MACVLAN_NAME down
|
ifconfig $MACVLAN_NAME down
|
||||||
ip link del $MACVLAN_NAME
|
ip link del $MACVLAN_NAME
|
||||||
```
|
```
|
||||||
|
|
||||||
* Persisting macvlan configuration
|
* Persisting macvlan configuration
|
||||||
Example:
|
Example:
|
||||||
* network: 192.168.1.0/24
|
* network: 192.168.1.0/24
|
||||||
* macvlan name:: macvlan_bridge
|
* macvlan name:: macvlan_bridge
|
||||||
* macvlan static ip: 192.168.1.240/32
|
* macvlan static ip: 192.168.1.240/32
|
||||||
* docker containers on macvlan networks:
|
* docker containers on macvlan networks:
|
||||||
* 192.168.1.254
|
* 192.168.1.254
|
||||||
* 192.168.1.253
|
* 192.168.1.253
|
||||||
* 192.168.1.250
|
* 192.168.1.250
|
||||||
* 192.168.1.248
|
* 192.168.1.248
|
||||||
|
|
||||||
```text
|
```text
|
||||||
# create/edit /etc/network/interfaces.d/macvlan_bridge
|
# create/edit /etc/network/interfaces.d/macvlan_bridge
|
||||||
iface macvlan_bridge inet manual
|
iface macvlan_bridge inet manual
|
||||||
pre-up ip link add macvlan_bridge link eth0 type macvlan mode bridge
|
pre-up ip link add macvlan_bridge link eth0 type macvlan mode bridge
|
||||||
pre-up ip addr add 192.168.1.240/32 dev macvlan_bridge
|
pre-up ip addr add 192.168.1.240/32 dev macvlan_bridge
|
||||||
up ip link set macvlan_bridge up
|
up ip link set macvlan_bridge up
|
||||||
post-up ip route add 192.168.1.254 dev macvlan_bridge
|
post-up ip route add 192.168.1.254 dev macvlan_bridge
|
||||||
post-up ip route add 192.168.1.253 dev macvlan_bridge
|
post-up ip route add 192.168.1.253 dev macvlan_bridge
|
||||||
post-up ip route add 192.168.1.252 dev macvlan_bridge
|
post-up ip route add 192.168.1.252 dev macvlan_bridge
|
||||||
post-up ip route add 192.168.1.250 dev macvlan_bridge
|
post-up ip route add 192.168.1.250 dev macvlan_bridge
|
||||||
post-up ip route add 192.168.1.248 dev macvlan_bridge
|
post-up ip route add 192.168.1.248 dev macvlan_bridge
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
apt install --yes fuse-overlayfs
|
apt install --yes fuse-overlayfs
|
||||||
curl -fsSL "https://get.docker.com" -o get-docker.sh
|
curl -fsSL "https://get.docker.com" -o get-docker.sh
|
||||||
sh get-docker.sh
|
sh get-docker.sh
|
||||||
Reference in New Issue
Block a user