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
我尝试了上述所有dockerfile版本,但每次遇到相同的错误时:
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
最佳答案
在我接受之前,有人发布了答案并将其删除。但这是-
FROM ubuntu:latest
MAINTAINER ME
RUN apt-get update && apt-get install -y \
net-tools inetutils-traceroute \
iputils-ping xinetd telnetd
这有效!!
关于linux - Docker构建失败:返回了非零代码:1,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/46110294/