Last active
November 18, 2015 21:36
-
-
Save sajayantony/1906cad1574c5f5212f4 to your computer and use it in GitHub Desktop.
Redis docker commands
This file contains 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
#!/bin/bash | |
echo Stopping redis containers.. | |
docker ps -a | grep redis | |
docker ps -a | grep redis | awk '{print $1}' | xargs --no-run-if-empty -n1 docker stop | xargs --no-run-if-empty -n1 docker rm | |
This file contains 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
#!/bin/bash | |
count=10 | |
echo Bash Version : ${BASH_VERSION} | |
echo Running $count redis containers. | |
for((i = 0;i < count; i++)){ | |
port=$((6380+i)); | |
docker run -d -p 172.30.168.213:$port:6379 --name redis$i redis redis-server | |
} | |
echo Current running instances. | |
docker ps -a | |
echo Exposing ports using ufw | |
echo sudo ufw allow 6380:$port/tcp | |
sudo ufw allow 6380:$port/tcp | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment