【发布时间】:2018-04-06 21:36:40
【问题描述】:
我有一个设置 NGINX、PHP 的 dockerfile,添加了一个 Wordpress 存储库。我想在启动时启动 PHP 和 NGINX。但是,我没有这样做。我尝试在 CMD 数组中添加这两个命令,还尝试将它们放入 shell 文件并启动 shell 文件。没有任何效果。下面是我的 Dockerfile
FROM ubuntu:16.04
WORKDIR /opt/
#Install nginx
RUN apt-get update
RUN apt-get install -y nginx=1.10.* php7.0 php7.0-fpm php7.0-mysql
#Add the customized NGINX configuration
RUN rm -f /etc/nginx/nginx.conf
RUN rm -f /etc/nginx/sites-enabled/*
COPY nginx/nginx.conf /etc/nginx/
COPY nginx/site.conf /etc/nginx/sites-enabled
#Copy the certificates
RUN mkdir -p /etc/pki/nginx
COPY nginx/certs/* /etc/pki/nginx/
RUN rm -f /etc/pki/nginx/placeholder
#Copy the build to its destination on the server
RUN mkdir -p /mnt/wordpress-blog/
COPY . /mnt/wordpress-blog/
#COPY wp-config.php
COPY nginx/wp-config.php /mnt/wordpress-blog/
#The command to run the container
CMD ["/bin/bash", "-c", "service php7.0-fpm start", "service nginx start"]
我尝试将 CMD 中的命令放在 shell 文件中,并在 CMD 命令中运行 shell 文件。它仍然没有工作。我错过了什么?
【问题讨论】:
-
这可能对你有帮助 - stackoverflow.com/questions/49090469/…
标签: php docker nginx dockerfile