HiveBrain v1.2.0
Get Started
← Back to all entries
debugMinor

Dockerfile parse error line 5: unknown instruction: -ESSENTIAL

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
erroressentiallineunknowninstructionparsedockerfile

Problem

this is my dockerfile ;

FROM ubuntu:16.04
MAINTAINER James Turnbull "james@example.com"
ENV REFRESHED_AT 2016-06-01
RUN apt-get update -yqq; apt-get -yqq install ruby ruby-dev build 
  -essential redis-tools

RUN gem install --no-rdoc --no-ri sinatra json redis
RUN mkdir -p /opt/webapp
EXPOSE 4567

CMD [ "/opt/webapp/bin/webapp" ]


and this is how i ran it :


docker build -t jamtur01/sinatra .

however i get this error in regard to -essential


Dockerfile parse error line 5: unknown instruction: -ESSENTIAL

i am not clear what i have done wrong. is there an equivalent for -essential

Solution

I assume you have a copy-paste issue. The right package name is build-essential. And if you want to split a RUN statement over several lines, you will have to use backslash for line continuation.

All that leading to something along the lines of:

RUN apt-get update -yqq; apt-get -yqq install ruby ruby-dev \
          build-essential redis-tools


As a personal suggestion, when you have several commands to run, it is usually better to join them using && rather than ; since you want the build to fail if either command is failing.

RUN apt-get update -yqq && apt-get -yqq install ruby ruby-dev \
          build-essential redis-tools

Code Snippets

RUN apt-get update -yqq; apt-get -yqq install ruby ruby-dev \
          build-essential redis-tools
RUN apt-get update -yqq && apt-get -yqq install ruby ruby-dev \
          build-essential redis-tools

Context

StackExchange DevOps Q#6236, answer score: 3

Revisions (0)

No revisions yet.