0

I run docker build -t imagename .

I get the following error :

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

Can anyone tell me what I should to fix this. I downgraded from 17.12 to 17.06 so that I dont get Bad Response from Docker Enginer when I build. Others work fine. I can pull and run other images. I can't build. Please help and suggest a fix thank you!

My docker version is

Docker version 17.06.2-ce, build cec0b72

Docker info is:

 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 file is:

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"] 
Fendi jatmiko
  • 2,567
  • 1
  • 9
  • 15
papaya
  • 1,505
  • 1
  • 13
  • 26
  • 1
    The error message seems to suggest that Docker treats your entire Dockerfile as a single line. The snippet you've provided have proper line terminators - is it the case for the original file as well? – korolar Jan 15 '18 at 16:31
  • 1
    What end of line characters are you using in the dockerfile? – twinklehawk Jan 15 '18 at 16:31

3 Answers3

1

try use ARG, so instead of just

FROM ubuntu:14.04
ENV MAVEN_VERSION 3.3.9

change to

FROM ubuntu:14.04
ARG MAVEN_VERSION=3.5.9
Fendi jatmiko
  • 2,567
  • 1
  • 9
  • 15
  • sure.. glad could help.. if this answer has solved your question please consider accepting it by clicking the check-mark. This indicates to the wider community that you've found a solution and gives some reputation to both the answerer and yourself. There is no obligation to do this. – Fendi jatmiko Jan 15 '18 at 17:24
1

In my case this error was caused by having a Dockerfile with CR line-endings on Windows. Converting to CRLF or LF solved the issue.

midgetspy
  • 669
  • 1
  • 5
  • 8
0

While it's not the same cause as with the problem the OP had, I had the exact same error after following a tutorial.

Turns out said tutorial had comments at the end of each config line e.g. FROM python:3 # the base image

On removing the comments, all was fine (turns out a '#' must be at the beginning of a comment as discussed here).