A Nebula overlay network in Docker Compose. Configures a Lighthouse and two server endpoints. Demonstrates nginx and ssh accessible only from inside the overlay network.
Based on the Nebula Quick Start Guide. Tested on Mac with M1 Apple Silicon.
./setup-mac.sh
docker compose up -d --build
docker compose exec netshoot2 ssh [email protected]
Won't work outside overlay:
docker compose exec netshoot2 ssh [email protected]
docker compose exec netshoot2 http 192.168.100.11
Won't work outside overlay:
docker compose exec netshoot2 http 192.168.42.11
docker compose exec server1 ping 192.168.100.1 -c 2
docker compose exec server1 ping 192.168.42.42 -c 2
docker compose exec server1 ping 192.168.100.12 -c 2
docker compose exec server1 ping 192.168.42.12 -c 2
docker compose exec lighthouse ping 192.168.100.11 -c 2
docker compose exec lighthouse ping 192.168.42.11 -c 2
docker compose exec lighthouse ping 192.168.100.12 -c 2
docker compose exec lighthouse ping 192.168.42.12 -c 2
docker compose exec server2 ping 192.168.100.1 -c 2
docker compose exec server2 ping 192.168.42.42 -c 2
docker compose exec server2 ping 192.168.100.11 -c 2
docker compose exec server2 ping 192.168.42.11 -c 2
docker compose down && docker compose up -d --build
Run single container with normal nebula entrypoint
docker run --rm -v ./lighthouse/config.yaml:/config/config.yaml -v ./lighthouse/pki:/etc/nebula --cap-add=NET_ADMIN --device /dev/net/tun nebula-alpine
Run and attach to shell
docker run -it --rm -v ./lighthouse/config.yaml:/config/config.yaml -v ./lighthouse/pki:/etc/nebula --cap-add=NET_ADMIN --device /dev/net/tun --entrypoint sh nebula-alpine
Direct ssh (would reqire a host port mapping)
ssh -i ubuntu-ssh/ssh_keys/id_rsa -p 2222 root@localhost