Last active
May 31, 2018 05:56
-
-
Save majgis/22c55fe389d76f8c04e57b555941e13d to your computer and use it in GitHub Desktop.
docker run helper function
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
# Execute docker run with --rm --network shared | |
# The shared network will be created if it dosn't already exist | |
dr () { | |
docker network inspect shared > /dev/null 2>&1 | |
if [ $? -ne 0 ] | |
then | |
docker network create shared > /dev/null 2>&1 | |
fi | |
local DOCKER_CMD="docker run --rm --network shared $@" | |
echo | |
echo "${DOCKER_CMD}" | |
echo | |
eval "${DOCKER_CMD}" | |
} |
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
$ dr -it --name alpinetest alpine ash | |
docker run --rm --network shared -it --name alpinetest alpine ash | |
/ # |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment