我的web docker容器映像未运行
我尝试使用docker for laravel项目,我使用Ubuntu作为基础映像和laravel依赖性,但在docker编写之后,只有mysql和adminer容器在运行。下面是我的Dockerfile和docker-compose.yml文件 我的Dockerfile我的web docker容器映像未运行,docker,laravel-5,docker-compose,Docker,Laravel 5,Docker Compose,我尝试使用docker for laravel项目,我使用Ubuntu作为基础映像和laravel依赖性,但在docker编写之后,只有mysql和adminer容器在运行。下面是我的Dockerfile和docker-compose.yml文件 我的Dockerfile FROM ubuntu:16.04 Run apt-get update RUN apt-get update \ && apt-get install -y --no-install-recommends s
FROM ubuntu:16.04
Run apt-get update
RUN apt-get update \
&& apt-get install -y --no-install-recommends software-properties-common
RUN apt-get update
RUN apt-get install -y apache2
RUN apt-get install -y php7.0 php7.0-mysql php7.0-mbstring
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN apt-get update
RUN apt-get install -y git zip unzip
RUN apt-get update
COPY laravel/ /var/www/html/
COPY laravel//vhost.conf /etc/apache2/sites-available/000-default.conf
WORKDIR /var/www/html
RUN chown -R www-data:www-data /var/www/html \
&& a2enmod rewrite
****docker yml文件****
version: '2'
services:
db:
image: mysql
environment:
MYSQL_ROOT_PASSWORD: mysql
ports:
- 8086:3306
adminer:
image: adminer
ports:
- 8085:8080
web:
image: laravel
ports:
- 8889:80
volumes:
- .bilbayt_admin/:/var/www/html/
查看Dockerfile,您需要或,通常添加为Dockerfile的最后一行。这些条目告诉图像当您运行
docker时要运行哪个命令(这是通过docker compose up以迂回的方式完成的)。您需要添加一个cmd来启动apache/入口点
结尾处类似于下面的内容
CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
现在我的Docker文件看起来像这样,并且它正在工作
从ubuntu:16.04运行apt-get-update运行apt-get-update\
&&apt get install-y--无安装建议使用通用软件属性
运行apt获取更新
运行apt get install
-y apache2运行apt get安装-y php7.0 php7.0-mysql php7.0-mbstring
运行curl-sS | php--
--install dir=/usr/local/bin--filename=composer
运行apt获取更新
运行apt get install-y git zip解压
运行apt获取更新
抄袭/var/www/html
COPY.docker/vhost.conf/etc/apache2/sites available/000 default.conf
WORKDIR/var/www/html
运行chown-R www-data:www-data/var/www/html\
&&a2enmod重写
CMD[“/usr/sbin/apache2ctl”、“-D”、“前台”]您是否收到任何错误?“docker logs img”不,我没有收到任何错误。对于apache docker的初学者,您需要一个入口点。