Skip to content

Commit

Permalink
Merge pull request #5 from ryandaniels/update-help-message
Browse files Browse the repository at this point in the history
update help message with another example
  • Loading branch information
ryandaniels authored Sep 15, 2022
2 parents aed09da + cc29560 commit 9592700
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,14 @@ If you are unlucky, continue on..

## Usage

The Docker image name (-n) must match the name (REPOSITORY) from "docker images". For example "traefik" (which is an "Official" image), or "portainer/portainer".

```bash
./docker_image_find_tag.sh -h
Usage:
./docker_image_find_tag.sh [-n image name] [-i image-id]
Example: ./docker_image_find_tag.sh -n traefik -i 96c63a7d3e50 -f 1.7
-n [text]: Image name (Required). '-n traefik' would reference the traefik image
-n [text]: Image name (Required). '-n traefik' would reference the traefik image or '-n portainer/portainer' for portainer
-i [text]: Image ID. Required if Image ID (Long) (-L) is ommited.
Found in 'docker images'. Can also use -i image:tag
-L [text]: Image ID (Long). Required if Image ID (-i) is ommited
Expand Down
5 changes: 4 additions & 1 deletion docker_image_find_tag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ show_help () {
echo "Usage:"
echo "$0 [-n image name] [-i image-id]"
echo "Example: $0 -n traefik -i 96c63a7d3e50 -f 1.7"
echo " -n [text]: Image name (Required). '-n traefik' would reference the traefik image"
echo " -n [text]: Image name (Required). '-n traefik' would reference the traefik image or '-n portainer/portainer' for portainer"
echo " -i [text]: Image ID. Required if Image ID (Long) (-L) is ommited."
echo " Found in 'docker images'. Can also use -i image:tag"
echo " -L [text]: Image ID (Long). Required if Image ID (-i) is ommited"
Expand Down Expand Up @@ -88,6 +88,7 @@ shift $((OPTIND-1))

if [ -z "$IMAGE_NAME" ]; then
echo "Requires Image Name"
show_help
exit 1;
else
if [[ "$VERBOSE" -eq 1 ]]; then
Expand All @@ -102,6 +103,7 @@ fi

if [ -z "$IMAGE_ID_SHORT" ] && [ -z "$IMAGE_ID_LONG" ]; then
echo "Requires Image ID or Image ID (Long)"
show_help
exit 1;
fi

Expand All @@ -116,6 +118,7 @@ if [ -z "$IMAGE_ID_LONG" ]; then
# Make sure IMAGE_ID_LONG has value (should never happen)
if [ -z "$IMAGE_ID_LONG" ]; then
echo "Error: Id of $IMAGE_ID_SHORT is empty"
show_help
exit 1;
fi
# podman (tested on v1.7.0 & 1.8.0) omits sha256: from beginning of Id, fix:
Expand Down

0 comments on commit 9592700

Please sign in to comment.