将 Gunicorn Systemd 文件传递到 Dockerfile
Passing Gunicorn Systemd File into Dockerfile
我无法将正确的语法放入我的 docker 文件中以使用 docker-compose 构建它。
这是我的 docker 文件:
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
当我尝试构建它时,我得到以下信息:
> Error response from daemon: Dockerfile parse error line 5: unknown instruction: '[UNIT]
什么是正确的语法
docker 容器内没有初始化(默认)
您必须定义一个 Dockerfile :
- 安装 gunicorn
- 推送配置文件
- 告诉容器启动一个像
gunicorn [...]
这样的命令
推送配置文件的详细信息,在您的 docker 文件中:
COPY /path/to/local/config/file /path/to/file/inside/container
注意:不要将 unix 套接字与容器一起使用,而是公开端口以使您的服务可供共享同一网络的其他容器使用。
我无法将正确的语法放入我的 docker 文件中以使用 docker-compose 构建它。
这是我的 docker 文件:
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
当我尝试构建它时,我得到以下信息:
> Error response from daemon: Dockerfile parse error line 5: unknown instruction: '[UNIT]
什么是正确的语法
docker 容器内没有初始化(默认)
您必须定义一个 Dockerfile :
- 安装 gunicorn
- 推送配置文件
- 告诉容器启动一个像
gunicorn [...]
这样的命令
推送配置文件的详细信息,在您的 docker 文件中:
COPY /path/to/local/config/file /path/to/file/inside/container
注意:不要将 unix 套接字与容器一起使用,而是公开端口以使您的服务可供共享同一网络的其他容器使用。