fix: check if network exists

This commit is contained in:
Abdud Dayan Adeeb 2021-02-15 16:21:09 -05:00
parent 6321bad333
commit f451fad679
2 changed files with 6 additions and 3 deletions

View file

@ -1,8 +1,7 @@
# Docker Run Action
- run a privately-owned image.
- run an image built by a previous step.
- run a specific step in docker.
- run an image built by a previous step.
- See https://github.com/addnab/docker-run-action/blob/main/action.yml for all the available inputs.
#### Typical Use Case

View file

@ -6,4 +6,8 @@ fi
echo "$INPUT_RUN" | sed -e 's/\\n/;/g' > semicolon_delimited_script
exec docker run -v "/var/run/docker.sock":"/var/run/docker.sock" --network=$INPUT_DOCKER_NETWORK $INPUT_OPTIONS --entrypoint=$INPUT_SHELL $INPUT_IMAGE -c "`cat semicolon_delimited_script`"
if [ ! -z $INPUT_DOCKER_NETWORK ];
then INPUT_OPTIONS="$INPUT_OPTIONS --network $INPUT_DOCKER_NETWORK"
fi
exec docker run -v "/var/run/docker.sock":"/var/run/docker.sock" $INPUT_OPTIONS --entrypoint=$INPUT_SHELL $INPUT_IMAGE -c "`cat semicolon_delimited_script`"