0

我跑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

码头工人信息是:

 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"] 
4

3 回答 3

1

尝试使用ARG,所以不仅仅是

FROM ubuntu:14.04
ENV MAVEN_VERSION 3.3.9

改成

FROM ubuntu:14.04
ARG MAVEN_VERSION=3.5.9
于 2018-01-15T16:38:40.040 回答
0

虽然这与 OP 遇到的问题的原因不同,但在遵循教程后我遇到了完全相同的错误。

原来说教程在每个配置行的末尾都有注释,例如 FROM python:3 # the base image

删除评论后,一切都很好(原来,'#' 必须在评论的开头,如此处所述

于 2021-09-24T18:03:18.157 回答
0

在我的情况下,这个错误是由于在 Windows 上有一个带有 CR 行结尾的 Dockerfile 引起的。转换为 CRLF 或 LF 解决了这个问题。

于 2021-11-24T21:05:47.497 回答