Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker部署出错 #115

Open
mafei2021 opened this issue May 31, 2021 · 3 comments
Open

docker部署出错 #115

mafei2021 opened this issue May 31, 2021 · 3 comments

Comments

@mafei2021
Copy link

Traceback (most recent call last):
File "/usr/local/bin/pip3", line 7, in
from pip._internal.cli.main import main
File "/usr/local/lib/python3.5/dist-packages/pip/_internal/cli/main.py", line 58
sys.stderr.write(f"ERROR: {exc}")
^
SyntaxError: invalid syntax
ERROR: Service 'web' failed to build: The command '/bin/sh -c pip3 install pip==20.3.4' returned a non-zero code: 1

这是我部署的时候报的错,后来发现是官方dockerfile里面pip的版本问题
在修改nginx.conf 修改之前加一个 RUN pip3 install pip==20.3.4 就可以了

以下是我改之后的DockerFile

FROM ubuntu:16.04
MAINTAINER Tuuu Nya<song@secbox.cn>

# install system requirement
RUN sed -i s/archive.ubuntu.com/mirrors.aliyun.com/g /etc/apt/sources.list
RUN sed -i s/security.ubuntu.com/mirrors.aliyun.com/g /etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y python3 python3-dev python3-pip nginx supervisor libmysqlclient-dev redis-server libssl-dev libffi-dev && \
    rm -rf /var/lib/apt/lists/*
# RUN pip3 install --upgrade pip
# 这一行是我加的
RUN pip3 install pip==20.3.4
# setup all the configfiles
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
RUN rm -rf /etc/nginx/sites-enabled/default
RUN sed -i '/include \/etc\/nginx\/sites-enabled\//a\\tinclude /home/docker/Github-Monitor/docker/nginx-app.conf;' /etc/nginx/nginx.conf
RUN sed -i 's/\/etc\/supervisor\/conf.d\/\*.conf/\/home\/docker\/Github-Monitor\/docker\/supervisor-app.conf/g' /etc/supervisor/supervisord.conf

# install requirement
COPY server/requirements.pip /requirement.txt
RUN pip3 install -r /requirement.txt -i http://pypi.doubanio.com/simple --trusted-host pypi.doubanio.com

# volumne
VOLUME ["/var/lib/redis"]
VOLUME ["/home/docker/Github-Monitor/"]

WORKDIR /home/docker/Github-Monitor/

ENV LANG C.UTF-8

EXPOSE 80

CMD ["/bin/bash", "/home/docker/Github-Monitor/docker/run.sh"]

@ddgszc
Copy link

ddgszc commented Jun 21, 2021

我也遇到了这个问题,谢谢你

@zhaijingrong
Copy link

感谢大佬,我也是碰到这个问题。升级pip的时候最好也加一下pip源。

@TuuuNya
Copy link
Member

TuuuNya commented Aug 10, 2021

建议提个PR 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants