使用Dockerfile

时间:2016-12-16 05:55:20

标签: python mongodb tomcat docker

我使用下面提到的Dockerfile来安装pythonmongodbtomcaton Centos6的软件包。

FROM centos:centos6
RUN yum install -y centos-release-scl && \
    yum install python27 &&
    echo -e "[mongodb-org-3.2]\nname=MongoDB Repository\nbaseurl==https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/\ngpgcheck=1\nenabled=1\ngpgkey=https://www.mongodb.org/static/pgp/server-3.2.asc" > /etc/yum.repos.d/mongodb-org.repo && \
    yum install -y mongodb-org && \
    yum install -y tomcat6
CMD ["/bin/bash"]

我收到了以下错误

您的交易已保存,请重新运行:

yum load-transaction /tmp/yum_save_tx-2016-12-16-05-51EmkBfY.yumtx

命令

/bin/sh -c yum install -y centos-release-scl &&     yum install python27 &&     echo -e "[mongodb-org-3.2]\nname=MongoDB Repository\nbaseurl==https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/\ngpgcheck=1\nenabled=1\ngpgkey=https://www.mongodb.org/static/pgp/server-3.2.asc" > /etc/yum.repos.d/mongodb-org.repo &&     yum install -y mongodb-org &&     yum install -y tomcat6

returned a non-zero code: 1

不确定可能出现的问题是什么?

1 个答案:

答案 0 :(得分:1)

使用以下dockerfile

FROM centos:centos6
RUN yum install -y centos-release-scl && \
    yum install -y python27 && \
    echo -e "[mongodb-org-3.2]\nname=MongoDB Repository\nbaseurl==https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/\ngpgcheck=1\nenabled=1\ngpgkey=https://www.mongodb.org/static/pgp/server-3.2.asc" > /etc/yum.repos.d/mongodb-org.repo && \
    yum install -y mongodb-org && \
    yum install -y tomcat6
CMD ["/bin/bash"]

-y之前您遗失python27 \之后遗失python27 &&