FROM需要一个或三个参数Docker

时间:2018-01-15 16:17:26

标签: java docker dockerfile docker-build

我运行docker build -t imagename .

我收到以下错误:

 Step 1/1 : FROM ubuntu:14.04 
 ENV MAVEN_VERSION 3.3.9 RUN mkdir -p /usr/share/maven \ 
 && curl -fsSL http://apache.osuosl.org/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz \ | 
 tar -xzC /usr/share/maven --strip-components=1 \
 && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn ENV MAVEN_HOME 
 /usr/share/maven VOLUME /root/.m2 CMD ["mvn"]
        **FROM requires either one or three arguments**

任何人都可以告诉我应该解决这个问题。我从17.12降级到17.06,所以当我建造时我不会得到Bad Response from Docker Enginer。其他人工作正常。我可以拉动并运行其他图像。我无法建立。请帮忙并建议修复,谢谢!

我的泊坞窗版本是

Docker version 17.06.2-ce, build cec0b72

Docker信息是:

 Containers: 1
 Running: 0
 Paused: 0
 Stopped: 1
Images: 1
Server Version: 17.06.2-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host ipvlan macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 6e23458c129b551d5c9871e5174f6b1b7
runc version: 810190ceaa507aa2727d7ae6f4790c76ec150bd
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.41-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.934GiB
Name: moby
ID: 3S5I:DUOJ:EBRI:PRH6:VMBJ:6H3K:OBZB:HFH7:7RSH:XEO5
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 15
 Goroutines: 26
 System Time: 2018-01-15T16:10:58.5589804Z
 EventsListeners: 0
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

Docker文件是:

FROM ubuntu:14.04
ENV MAVEN_VERSION 3.3.9

RUN mkdir -p /usr/share/maven \
  && curl -fsSL http://apache.osuosl.org/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz \
    | tar -xzC /usr/share/maven --strip-components=1 \
  && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn

ENV MAVEN_HOME /usr/share/maven

VOLUME /root/.m2

CMD ["mvn"] 

1 个答案:

答案 0 :(得分:1)

尝试使用 ARG ,而不仅仅是

FROM ubuntu:14.04
ENV MAVEN_VERSION 3.3.9

更改为

FROM ubuntu:14.04
ARG MAVEN_VERSION=3.5.9