Cannot use Docker-compose scale to bring up multiple containers on a same network.
steps to reproduce.
dockerfile : FROM ubuntu:18.04
RUN apt-get update && apt-get install curl gpg sudo iputils-ping netcat supervisor bash -y
RUN curl -s 'https://raw.githubusercontent.com/zerotier/ZeroTierOne/master/doc/contact%40zerotier.com.gpg' | gpg --import && if z=$(curl -s 'https://install.zerotier.com/' | gpg); then echo "$z" | sudo bash; fi
COPY entrypoint.sh /bin/
RUN chmod +x /bin/entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]
entrypoint.sh : #!/bin/sh echo $netId service zerotier-one start /usr/sbin/zerotier-cli join $netId sleep 0 tail -F /dev/null
I'm Passing netId with a env_file, (not a .env file) and i can echo it inside the containers.
docker-compose.yml : version: '3'
services: net: build: . privileged: true cap_add: - 'NET_ADMIN' - 'SYS_ADMIN' devices: - '/dev/net/tun' env_file: env_netId
when i do docker-compose up -d --scale net=5, the 5 container come up without any erros, this can be check by docker container logs (container_id)
however, only one device is listed. i'm trying to emulate a network of ubuntu devices connected with zero-tier. maybe i should isolate each container's network? any help appreciated.