Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include wrapper script #1

Open
srl295 opened this issue Sep 22, 2022 · 0 comments
Open

include wrapper script #1

srl295 opened this issue Sep 22, 2022 · 0 comments
Assignees

Comments

@srl295
Copy link
Member

srl295 commented Sep 22, 2022

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} $*
@srl295 srl295 self-assigned this Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant