Skip to content

Instantly share code, notes, and snippets.

@daimor
Last active Jan 26, 2018
Embed
What would you like to do?
csession script which working with docker
#!/bin/bash
NAME=$1
CONTAINER=`docker container ls -q -f "name=$NAME"`
if [ -z $CONTAINER ]
then
echo "Docker container with name $NAME not found"
exit 1
fi
INSTANCE=`docker container inspect $CONTAINER -f '{{range .Config.Env }}{{println .}}{{end}}' | grep 'ISC_PACKAGE_INSTANCENAME' | cut -d'=' -f2`
echo "Container $CONTAINER"
echo "Instance $INSTANCE"
if [ -z $INSTANCE ]
then
echo "Cache instance in container with name $NAME not found"
exit 1
fi
docker exec -it $CONTAINER csession $INSTANCE ${@:2}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment