我的dockerfile
FROM php:7.0-apache
RUN pecl install -o -f redis
RUN pecl install -o -f xdebug
RUN docker-php-ext-enable redis
RUN docker-php-ext-enable xdebug
RUN docker-php-ext-install pdo pdo_mysql mysqli
RUN apt-get update
RUN apt-get install locales-all -y
我的docker-compose文件
version: "3.7"
services:
redis:
restart: unless-stopped
image: redis:alpine
container_name: redis_mp
volumes:
- redis-data:/data
# if we need a custom redis configuration
# - ./docker//usr/local/etc/redis/redis.conf:/usr/local/etc/redis/redis.conf
mysql:
restart: unless-stopped
image: mysql:5.6
container_name: mysql_mp
command: --default-authentication-plugin=mysql_native_password
ports:
# So you can use a database client on your host machine
- 3306:3306
environment:
- MYSQL_ROOT_PASSWORD=secret
volumes:
- mysql-data:/var/lib/mysql
# if we need a custom mysql configuration
# - ./docker/etc/mysql/conf.d:/etc/mysql/conf.d
apache:
restart: unless-stopped
# image: php:7.2-apache
build: ./docker/Dockerfiles/apache
container_name: apache_mp
# command: bash -c "docker-php-ext-install pdo pdo_mysql && service apache2 restart"
depends_on:
- mysql
- redis
- certbot
ports:
# Exposing both http and https
- 80:80
- 443:443
environment:
- APACHE_DOCUMENT_ROOT=/var/www/html/public/
volumes:
- .:/home/medpets/WWW/
- ./docker/etc/apache2:/etc/apache2/
- ./docker/usr/local/etc/php/php.ini:/usr/local/etc/php/php.ini
- apache-log:/home/medpets/LOG/
- ./docker/etc/letsencrypt:/etc/letsencrypt/
- ./docker/etc/ssl:/etc/ssl/
certbot:
restart: "no"
image: certbot/certbot
container_name: certbot_mp
volumes:
- ./docker/etc/letsencrypt:/etc/letsencrypt/
volumes:
mysql-data:
redis-data:
apache-log:
问题