forked from raycast/script-commands
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-docker.sh
executable file
·34 lines (26 loc) · 1.01 KB
/
run-docker.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# Dependency: This script requires `docker for mac` to be installed: https://docs.docker.com/docker-for-mac/install/
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Run
# @raycast.mode compact
# @raycast.packageName Docker
# Optional parameters:
# @raycast.icon ▶️
# @raycast.needsConfirmation true
# @raycast.argument1 { "type": "text", "placeholder": "Port Machine" }
# @raycast.argument2 { "type": "text", "placeholder": "Port Docker" }
# @raycast.argument3 { "type": "text", "placeholder": "Image", "percentEncoded": true}
# Documentation:
# @raycast.description Runs a Docker container
# @raycast.author Fabián Delgado
# @raycase.authorURL https://github.com/fabdelgado
if ! command -v docker &> /dev/null; then
echo "docker for mac is required (https://docs.docker.com/docker-for-mac/install/).";
exit 1;
fi
if ! [[ "$(docker image inspect $3 2> /dev/null)" == "" ]]; then
docker pull $3
fi
docker run -d --rm -p $(($1)):$(($2)) $3
echo "Successfully running ${3}🚀"