0

I've downloaded a repository that contains a .sh script to open a Docker container. I'm running Windows 10 with Docker Toolbox (rather than the full version, which has some Hyper-V issues) and its associated shell, and I've tried running the script both in that and in git-bash (which is based on MinGW/mintty), and in both cases I get

$ ./build-image.sh Unknown target 

Here's the full script, lightly redacted for privacy:

case $1 in keras_base) docker build -f docker/keras_base docker -t foo:keras_base ;; keras_branch) git archive HEAD > bar.tar cp bar.tar docker/keras_branch branch=$(git rev-parse --abbrev-ref HEAD) docker build docker/keras_branch -t "foo:keras_${branch}" docker tag "foo:keras_${branch}" "XXXXXXXXXXX.dkr.ecr.us-east-1.amazonaws.com/foo:keras_${branch}" ;; *) echo Unknown target "$1"; exit 1 ;; esac 

1 Answer 1

0

In a classic case of rubber-duck debugging, writing this out helped me see the answer: the Unknown target argument is right there in the script, indicating that I hadn't given it an argument. Specifically, in bash scripts the arguments are zero-indexed prefixed by dollar signs, so $0 is the name of the script, and $1, $2, etc. are additional arguments. The first line case $1 in checks if $1 - the argument after the filename - is one of "keras_base" or "keras_branch". If it's not, or not provided, it returns Unknown target.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.