NOT BUG!!!!IT'S A MISTAKE!!!!why docker-maven-plugin give me an error dockerfile which had an '&'

372 views Asked by At

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<[email protected]>

 ---> 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?

1

There are 1 answers

2
cam On

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