Krishna
Krishna

Reputation: 3157

getting Invalid Reference Format while executing docker run

While executing below script,

sudo docker run -volume "$PWD:/build" -volume "~/.m2:/root/.m2" -volume "~/.build:/root/.build"`

i am getting below error:

docker: invalid reference format.
See 'docker run --help'.

OS using is ubuntu-18. Followed some stackoverflow threads, but missing something.

Upvotes: 0

Views: 378

Answers (1)

Pierre B.
Pierre B.

Reputation: 12923

sudo docker run -volume "$PWD:/build" -volume "~/.m2:/root/.m2" -volume "~/.build:/root/.build"

Your command has several issues:

  • -volume "$PWD:/build" is not proper syntax, you should use --volume "$PWD:/build" or -v "$PWD:/build"
  • you are missing an image name: docker run require you to specify which image to run, for example maven:3-jdk-8
  • it seems you are trying to run a Maven build, you should also specify the working directory with -w and Maven goals

For example:

sudo docker run -v "$PWD:/build" -w /build -v "~/.m2:/root/.m2" -v "~/.build:/root/.build" maven:3-jdk-8 mvn clean package

Upvotes: 1

Related Questions