Skip to content

Instantly share code, notes, and snippets.

@daimor
Last active January 26, 2018 08:21
Show Gist options
  • Save daimor/1f10d4aa89c9420b62b9662d004a2f45 to your computer and use it in GitHub Desktop.
Save daimor/1f10d4aa89c9420b62b9662d004a2f45 to your computer and use it in GitHub Desktop.
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