使用Django 2.0构建docker镜像失败

时间:2017-12-20 09:44:40

标签: python django docker build gitlab-ci

我目前正在使用最新版本的Django构建一个docker镜像,但在构建期间我得到了这个:

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-9LueOB/Django/
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The command '/bin/sh -c INSTALL_PKGS="python-pip oracle-instantclient-tnsnames.ora afs_tools_standalone nss_wrapper openssh-clients cx_Oracle libmemcached-devel python-ldap mod_wsgi httpd MySQL-python wassh-ssm-cern wassh" &&     INSTALL_PKGS_BUILD="gcc python-devel zlib-devel" &&     yum install -y centos-release-scl &&     yum update -y &&     yum install -y --setopt=tsflags=nodocs --enablerepo=centosplus $INSTALL_PKGS &&     yum install -y $INSTALL_PKGS_BUILD &&     rpm -e --nodeps centos-logos &&     pip install --upgrade &&     pip install -r requirements.txt &&     rm requirements.txt &&     yum remove -y $INSTALL_PKGS_BUILD &&     yum clean all -y &&     rm -rf /var/cache/yum &&     mkdir /var/django/ && mkdir -p /var/django/home/ &&     mkdir -p /usr/local/bin/ &&     mkdir -p /run/httpd/ && chown -R root:root /run/httpd && chmod a+rw /run/httpd' returned a non-zero code: 1

在我的requirements.txt上我正在使用:

Django==2.0
djangorestframework==3.2.1
pyapi-gitlab==7.8.4
pylibmc==1.5.0
django-logtail
python-gitlab

知道为什么会这样吗?

1 个答案:

答案 0 :(得分:1)

我相信它是因为Django 2.0不再支持Python 2.x了,试着替换" python" by" python3"在你的命令中。

编辑:或运行" pip3"而不是" pip"当你安装Django> = 2.0