我正在尝试对flask restful应用程序进行dockerize,并在ngnix代理服务器上运行它
我有一个Dockerfile,如下所示:
FROM python:3.7
USER root
RUN mkdir -p /app/thermo-restful
WORKDIR /app/thermo-restful
COPY requirements.txt /app/thermo-restful
COPY main.py /app/thermo-restful
EXPOSE 9000
RUN ["pip", "install", "-r", "requirements.txt"]
CMD ["uwsgi", "--socket", "0.0.0.0:9000", "--protocol", "http", "-w", "main:app"]
FROM nginx:latest
COPY default.conf /etc/nginx/conf.d/
EXPOSE 8000
CMD ["nginx", "-g", "daemon off;"]
ngnix的deault.conf如下所示:
server {
listen 8000;
location / {
proxy_pass http://server:9000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
然后,我构建了图像并使用以下命令运行它:
docker run -d -p 8000:8000 --name image-name-app image-name
但是图像运行不正常,查看容器的日志,它提供了以下信息:
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: error: /etc/nginx/conf.d/default.conf differs from the packaged version
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2020/08/14 08:50:39 [emerg] 1#1: host not found in upstream "server" in /etc/nginx/conf.d/default.conf:4
nginx: [emerg] host not found in upstream "server" in /etc/nginx/conf.d/default.conf:4
有人能告诉我哪里做错了吗
目前没有回答
相关问题 更多 >
编程相关推荐