Created
July 26, 2019 15:54
-
-
Save ik5/858d635a6b601b472790699803e3dc04 to your computer and use it in GitHub Desktop.
Creating 10 workers, takes the host ip using docker
This file contains hidden or 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
#!/usr/bin/env bash | |
declare -i min=0 | |
declare -i max=10 | |
host=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+') | |
for (( c=min; c<max; c++ )) do | |
echo "Going to start worker # $c" | |
docker run\ | |
-e "DOCKER_HOST=$host"\ | |
-dit \ | |
--name "worker-$c"\ | |
local/worker:latest\ | |
/bin/bash -c "worker -queue-number $c" | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment