|
@ -9,33 +9,36 @@ badarg() { |
|
|
exit 2 |
|
|
exit 2 |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
help="Usage: $(basename $0) [-fch] [-l label] [-e options] image [container] |
|
|
help="Usage: $(basename $0) [-fcdh] [-l label] [-e options] image [container] |
|
|
Create and start a container from a local image, and assign it the given name. |
|
|
Create and start a container from a local image, and assign it the given name. |
|
|
|
|
|
|
|
|
If second argument is omitted, defaults to assigning the container the same name |
|
|
If second argument is omitted, defaults to assigning the container the same name |
|
|
as the image. |
|
|
as the image. |
|
|
|
|
|
|
|
|
Options: |
|
|
Options: |
|
|
-f Force overwrite if a container with the given name already exists |
|
|
|
|
|
-c Configure the container with deploy options stored in the image |
|
|
-c Configure the container with deploy options stored in the image |
|
|
metadata. By default, uses the metadata tag labeled 'config_default' |
|
|
metadata. By default, uses the metadata tag labeled 'config_default' |
|
|
-l [label] Label from which to get the deploy options. Automatically sets -c |
|
|
-d Dry-run |
|
|
-e [options] Extra deploy options to assign to the container. If -e and -c are |
|
|
-e [options] Extra deploy options to assign to the container. If -e and -c are |
|
|
both used, options from image metadata and command line are combined |
|
|
both used, options from image metadata and command line are combined |
|
|
|
|
|
-f Force overwrite if a container with the given name already exists |
|
|
|
|
|
-l [label] Label from which to get the deploy options. Automatically sets -c |
|
|
-h Display this help and exit" |
|
|
-h Display this help and exit" |
|
|
|
|
|
|
|
|
# Handle options |
|
|
# Handle options |
|
|
opt_force=0 |
|
|
opt_force=0 |
|
|
|
|
|
opt_dryrun=0 |
|
|
opt_config=0 |
|
|
opt_config=0 |
|
|
opt_label='config_default' |
|
|
opt_label='config_default' |
|
|
opt_extras='' |
|
|
opt_extras='' |
|
|
while getopts ':fcl:e:h' arg; do |
|
|
while getopts ':fcdl:e:h' arg; do |
|
|
case $arg in |
|
|
case $arg in |
|
|
f) opt_force=1;; |
|
|
|
|
|
c) opt_config=1;; |
|
|
c) opt_config=1;; |
|
|
l) opt_config=1; opt_label="${OPTARG}";; |
|
|
d) opt_dryrun=1;; |
|
|
e) opt_extras="${OPTARG}";; |
|
|
e) opt_extras="${OPTARG}";; |
|
|
|
|
|
f) opt_force=1;; |
|
|
h) echo "$help"; exit 0;; |
|
|
h) echo "$help"; exit 0;; |
|
|
|
|
|
l) opt_config=1; opt_label="${OPTARG}";; |
|
|
:) badarg "Argument missing for option '-$OPTARG'";; |
|
|
:) badarg "Argument missing for option '-$OPTARG'";; |
|
|
?) badarg "Invalid option '-$OPTARG'";; |
|
|
?) badarg "Invalid option '-$OPTARG'";; |
|
|
esac |
|
|
esac |
|
@ -76,5 +79,9 @@ if [[ $opt_force -eq 1 ]]; then |
|
|
podman rm -i -f "$container" |
|
|
podman rm -i -f "$container" |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
podman run -itd --name "$container" --hostname "$container" $deployconf "$image" |
|
|
if [[ $opt_dryrun -eq 1 ]]; then |
|
|
echo "Done!" |
|
|
echo podman run -itd --name "$container" --hostname "$container" $deployconf "$image" |
|
|
|
|
|
else |
|
|
|
|
|
podman run -itd --name "$container" --hostname "$container" $deployconf "$image" |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|