Popeye
Popeye

Reputation: 1558

Docker building fails: returned a non-zero code: 1

Dockerfile1

FROM ubuntu:latest
MAINTAINER ME
RUN apt-get update
RUN apt-get update && apt-get install -y net-tools \
&& apt-get install inetutils-traceroute \
&& apt-get install iputils-ping \
&& apt-get install xinetd telnetd

Dockerfile2

FROM ubuntu:latest
MAINTAINER ME
RUN apt-get update
RUN apt-get update && apt-get install -y net-tools
RUN apt-get update && apt-get install inetutils-traceroute
RUN apt-get update apt-get install iputils-ping
RUN apt-get install xinetd telnetd

Dockerfile3

FROM ubuntu:latest
MAINTAINER ME
RUN apt-get update
RUN apt-get install inetutils-traceroute
RUN apt-get install -y net-tools
RUN apt-get update apt-get install iputils-ping
RUN apt-get install xinetd telnetd

I tried all the above flavors of my dockerfile but every time I get the same error :

The command '/bin/sh -c apt-get update && apt-get install -y net-tools && apt-get install inetutils-traceroute && apt-get install iputils-ping && apt-get install xinetd telnetd' returned a non-zero code: 1

Upvotes: 3

Views: 28313

Answers (2)

Alex Titov
Alex Titov

Reputation: 101

try to use key -y for apt-get or apt managers, on docker side. For example:

RUN apt-get update
RUN apt -y install net-tools

Without -y, apt-get asks a clarifying question - "are you sure you want to install this?". Without answer docker droped installation with code 1. The issue in here.

Upvotes: 0

Popeye
Popeye

Reputation: 1558

Someone posted an answer and deleted it before I could accept it. But here it is -

FROM ubuntu:latest
MAINTAINER ME

RUN apt-get update && apt-get install -y \
net-tools inetutils-traceroute \
iputils-ping xinetd telnetd

This works!!

Upvotes: 6

Related Questions