Docker多阶段构build

我的dockerfile如下所示:

FROM python:2.7 as builder RUN pip install pika RUN pip install requests RUN pip install simplejson RUN pip install datetime RUN pip install grequests RUN pip install urllib RUN pip install pandas COPY Action.py ./Action.py COPY UtilFunctions.py ./UtilFunctions.py WORKDIR /app COPY . . FROM apline WORKDIR /app COPY --from=builder /app /app CMD [ "python","-u","./Action.py" ] 

在build立 – > sudo docker build –rm -t rule1-test。

给出以下错误 – >

 Step 1 : FROM python:2.7 as builder Error parsing reference: "python:2.7 as builder" is not a valid repository/tag 

Docker版本如下:

 Docker version 1.12.6, build 88a4867/1.12.6 

这个版本不支持多阶段我已经在centos机器上安装了docker

  yum install docker 

多阶段构build是Docker 17.05中的一个新function,因此您必须将Docker版本更新为17.05或更新的版本。