将Gunicorn Systemd文件传递到Dockerfile
我无法得到正确的语法到我的dockerfile中使用docker-compose来构build它。
这是我的dockerfile:
FROM centos:centos7 RUN sudo echo '[Unit] Description=gunicorn daemon After=network.target [Service] User=tahaarmando Group=nginx WorkingDirectory=/home/tahaarmando/Projects/platform ExecStart=/home/tahaarmando/Projects/platform/flower/bin/gunicorn --workers 3 --bind unix:/home/$ [Install] WantedBy=multi-user.target' >> /etc/systemd/system/gunicorn.service
当我尝试构build它时,我得到以下内容:
> Error response from daemon: Dockerfile parse error line 5: unknown instruction: '[UNIT]
什么是正确的语法
在docker容器中没有init(默认)
你必须定义一个Dockerfile:
- 安装gunicorn
- 推送configuration文件
- 说容器启动像
gunicorn [...]
命令gunicorn [...]
推送你的dockerfile里的configuration文件的细节:
COPY /path/to/local/config/file /path/to/file/inside/container
注意:不要在容器中使用unix套接字,而应该公开端口,以使您的服务可用于共享相同networking的其他容器。