-
-
Save elmariofredo/596163001988be8ed42f060c379ea565 to your computer and use it in GitHub Desktop.
Docker run and docker build simplified
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$1" ] | |
then | |
IMAGE=image | |
else | |
IMAGE=$1 | |
fi | |
WORK_DIR=$(docker image inspect ${IMAGE} --format='{{.Config.WorkingDir}}') | |
if [ -z "$WORK_DIR" ] | |
then | |
WORK_DIR=/workdir | |
fi | |
echo docker run -it --rm -v $PWD:$WORK_DIR --entrypoint sh "${IMAGE}" | |
docker run -it --rm -v $PWD:$WORK_DIR --entrypoint sh "${IMAGE}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
WORK_DIR=$(docker image inspect $1 --format='{{.Config.WorkingDir}}') | |
if [ -z "$WORK_DIR" ] | |
then | |
WORK_DIR=/workdir | |
fi | |
docker run -it --rm -v $PWD:$WORK_DIR --entrypoint sh "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment