-2

when i build my springboot project with docker. I got this error in my idea output.

Step 1/8 : FROM openjdk:8u171

 ---> 8c80ddf988c8

Step 2/8 : MAINTAINER zhujiaxin<783725554@qq.com>

 ---> Using cache

 ---> 47b81dfbadd7

Step 3/8 : RUN mkdir /codemanager & WORKDIR /codemanager

 ---> Running in 7b664699f8dc

**/bin/sh: 1: WORKDIR: not found**

one row in dockerfile i think have error

RUN mkdir /codemanager & WORKDIR /codemanager

my MAVEN plugin configuration is below

         <plugin>
                <groupId>com.spotify</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>1.2.2</version>
                <configuration>
                    <dockerHost>http://127.0.0.1:2375</dockerHost>
                    <dockerDirectory>${basedir}/docker</dockerDirectory>
                    <imageName>hnxx/itmanager</imageName>
                    <imageTags>
                        <imageTag>1.0</imageTag>
                    </imageTags>
                    <resources>
                        <resource>
                            <targetPath>/codemanager</targetPath>
                            <directory>${project.build.directory}</directory>
                            <include>${project.build.finalName}.jar</include>
                        </resource>
                    </resources>
                </configuration>
            </plugin>

could you tell me how to fix this error?

deceze
  • 510,633
  • 85
  • 743
  • 889
PaulZhu
  • 89
  • 8
  • Please post your complete Dockerfile. But it looks like the error is that the `RUN` command and `WORKDIR` command should be on separate lines. – cam Dec 14 '20 at 09:59
  • sorry about that. i delete this row once in another Dockerfile,but not this one. I make a mistake. – PaulZhu Dec 15 '20 at 12:46

1 Answers1

1

Your assumption seems about right. If you have a line in your Dockerfile like this, it will probably cause an error:

RUN mkdir /codemanager & WORKDIR /codemanager

Change to this, because the Dockerfile commands RUN and WORKDIR must be on separate lines:

RUN mkdir /codemanager
WORKDIR /codemanager
cam
  • 4,409
  • 2
  • 24
  • 34
  • thinks a lot :) I have an error in my Dockerfile . not error in docker-maven-plugin.i have a mistake – PaulZhu Dec 15 '20 at 12:42
  • sure! honestly it's hard to tell where the error is when dealing with Docker/Dockerfiles sometime! – cam Dec 15 '20 at 16:49