Skip to content

include wrapper script #1

@srl295

Description

@srl295

I'm using this right now. it's a lot faster than spinning up a container each time.

#!/bin/bash
cmd=$1
shift
BASE=/path/to/my/data
CONTAINER=dock-warrior
IMAGE=srl295/dock-warrior:dev
# make sure the container is running
containers=$(docker ps -q -f name=${CONTAINER})
if [[ "${containers}" = "" ]];
then
    # start it
    # https://stackoverflow.com/a/55734437/185799
    docker rm ${CONTAINER} &&  docker run -d --name ${CONTAINER} -v ${BASE}/data:/data:rw -v ${BASE}/config:/config:rw ${IMAGE} /bin/bash -c "trap : TERM INT; sleep infinity & wait"
fi

docker exec -it ${CONTAINER} /opt/bin/${cmd} $*

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions