1

//Runs android sdk on container

docker run -it — rm -v $(pwd)/sdk:/sdk thyrlian/android-sdk bash -c 'cp -a $ANDROID_HOME/. /sdk'

Throws below error

docker: invalid reference format.
See 'docker run --help'.
Code Ninja
  • 23
  • 4
Baala
  • 481
  • 3
  • 11

3 Answers3

2

You're looking too far in the command for the error. In this case it's earlier. In this command:

docker run -it — rm -v $(pwd)/sdk:/sdk thyrlian/android-sdk bash -c 'cp -a $ANDROID_HOME/. /sdk'

The invalid image name is the long dash: . The rm needs two normal dashes (since it's not a single character style arg like the -i and -t). Those are dashes that you'd type with the keyboard, and some editor that you've likely copy and pasted from converted that. The correct command is:

docker run -it --rm -v "$(pwd)/sdk:/sdk" thyrlian/android-sdk bash -c 'cp -a $ANDROID_HOME/. /sdk'

Note, you should always quote the path since it can contain a space that would also break the parsing of the args.

BMitch
  • 231,797
  • 42
  • 475
  • 450
0

The issue happens when the docker image name given in the command is invalid. Please try this command

docker run -it — rm -v "$(pwd)/sdk:/sdk thyrlian/android-sdk" bash -c 'cp -a $ANDROID_HOME/. /sdk'
Deepak Patankar
  • 3,076
  • 3
  • 16
  • 35
0

What's the exact command you need to run in the interactive terminal?

In your case,

"- rm" is incorrect, there should no space between - and rm, so it should be -rm

Secondly, it should be --rm and re try.

docker run -it --rm -v $(pwd)/sdk:/sdk thyrlian/android-sdk bash -c 'cp -a $ANDROID_HOME/. /sdk'
Anuradha Fernando
  • 1,063
  • 12
  • 17