Skip to content

Instantly share code, notes, and snippets.

@sajayantony
Last active November 18, 2015 21:36
Show Gist options
  • Save sajayantony/1906cad1574c5f5212f4 to your computer and use it in GitHub Desktop.
Save sajayantony/1906cad1574c5f5212f4 to your computer and use it in GitHub Desktop.
Redis docker commands
#!/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
#!/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