sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release
curl -sSL https://get.docker.com/ | CHANNEL=stable bash
sudo apt install jq -y && \
DOCKER_COMPOSE_VERSION=$(curl --silent https://api.github.com/repos/docker/compose/releases/latest | jq .name -r) && \
DOCKER_CLI_PLUGIN_PATH=/usr/local/lib/docker/cli-plugins && \
sudo mkdir -p $DOCKER_CLI_PLUGIN_PATH && \
sudo curl -L "https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-$(uname -s)-$(uname -m)" -o $DOCKER_CLI_PLUGIN_PATH/docker-compose && \
sudo chmod +x $DOCKER_CLI_PLUGIN_PATH/docker-compose
Easily deploy a structured Docker network template. Create isolated networks for management, production, and more with predefined subnets and gateways. Use this simple script to streamline network setup. Ideal for enhancing security and organization in Docker projects.
nano create_docker_networks.sh
#!/bin/bash
# Create Docker networks
# Create network: management
# VLAN ID: 99
docker network create --subnet=10.99.0.0/16 --gateway=10.99.0.1 --ip-range=10.99.0.0/16 --driver=bridge --attachable=true management
# Create network: DMZ
# VLAN ID: 80
docker network create --subnet=10.0.80.0/24 --gateway=10.0.80.1 --ip-range=10.0.80.0/24 --driver=bridge --attachable=true dmz
# Create network: security
# VLAN ID: 70
docker network create --subnet=10.0.70.0/24 --gateway=10.0.70.1 --ip-range=10.0.70.0/24 --driver=bridge --attachable=true security
# Create network: DN42
# VLAN ID: 42
# OPTIONAL!!! visit https://dn42.eu/Home
docker network create --subnet=10.42.42.0/24 --gateway=10.42.42.1 --ip-range=10.42.42.0/24 --driver=bridge --attachable=true dn42
# Create network: media
# VLAN ID: 30
docker network create --subnet=10.0.30.0/24 --gateway=10.0.30.1 --ip-range=10.0.30.0/24 --driver=bridge --attachable=true media
# Create network: GameLAN
# VLAN ID: 31
docker network create --subnet=10.0.31.0/24 --gateway=10.0.31.1 --ip-range=10.0.31.0/24 --driver=bridge --attachable=true gamelan
# Create network: PBS iSCSI
# VLAN ID: 21
# Proxmox Backup Server (PBS) to manage data transfers over iSCSI.
docker network create --subnet=10.0.21.0/24 --gateway=10.0.21.1 --ip-range=10.0.21.0/24 --driver=bridge --attachable=true pbs
# Create network: production
docker network create --subnet=10.0.1.0/24 --gateway=10.0.1.1 --ip-range=10.0.1.0/24 --driver=bridge --attachable=true production
# Create network: voip
docker network create --subnet=10.0.4.0/24 --gateway=10.0.4.1 --ip-range=10.0.4.0/24 --driver=bridge --attachable=true voip
# Create network: backup
docker network create --subnet=10.0.5.0/24 --gateway=10.0.5.1 --ip-range=10.0.5.0/24 --driver=bridge --attachable=true backup
# Create network: staging
docker network create --subnet=10.0.6.0/24 --gateway=10.0.6.1 --ip-range=10.0.6.0/24 --driver=bridge --attachable=true staging
# Create network: IoT
# VLAN ID: 101
docker network create --subnet=10.0.101.0/24 --gateway=10.0.101.1 --ip-range=10.0.101.0/24 --driver=bridge --attachable=true iot
# Create network: guest
# VLAN ID: 199
docker network create --subnet=10.0.199.0/24 --gateway=10.0.199.1 --ip-range=10.0.199.0/24 --driver=bridge --attachable=true guest
chmod +x create_docker_networks.sh && ./create_docker_networks.sh