我想用于Prestahop的本地开发。对于测试电子邮件,我想使用MailHog容器。在prestahop容器中使用docker php映像。我尝试在prestashop容器中安装sendmail,但看起来docker-compose up后未安装sendmail
我的docker-compose
version: '2'
services:
prestashop:
build: ./docker/prestashop
ports:
- 80:80
links:
- mariadb:mariadb
depends_on:
- mariadb
volumes:
- ./docker/common:/scripts
- ./src:/var/www/html
- ./src/modules:/var/www/html/modules
- ./src/themes:/var/www/html/themes
- ./src/override:/var/www/html/override
environment:
- PS_DEV_MODE=1
- DB_SERVER=mariadb
- DB_USER=root
- DB_PASSWD=root
- DB_NAME=prestashop
- PS_INSTALL_AUTO=0
mariadb:
build: ./docker/mariadb
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=prestashop
volumes:
- ./data:/var/lib/mysql
phpmyadmin:
image: phpmyadmin/phpmyadmin
links:
- mariadb
ports:
- 81:80
environment:
- PMA_HOST=mariadb
- PMA_USER=root
- PMA_PASSWORD=root
mailhog:
container_name: mailhog
image: mailhog/mailhog
restart: always
ports:
- 1025:1025
- 8025:8025
Dockerfile看起来像
FROM prestashop/prestashop:latest
RUN yes | pecl install xdebug-2.5.5 \
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.remote_connect_back=on" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.remote_port=9000" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "file_uploads=On" >> /usr/local/etc/php/conf.d/uploads.ini \
&& echo "memory_limit=128M" >> /usr/local/etc/php/conf.d/uploads.ini \
&& echo "upload_max_filesize=64M" >> /usr/local/etc/php/conf.d/uploads.ini \
&& echo "post_max_size=64M" >> /usr/local/etc/php/conf.d/uploads.ini \
&& echo "max_execution_time=600" >> /usr/local/etc/php/conf.d/uploads.ini \
&& echo "max_input_vars=10000" >> /usr/local/etc/php/conf.d/custom.ini \
&& echo "error_reporting-1" >> /usr/local/etc/php/conf.d/custom.ini \
&& echo "display_errors = On" >> /usr/local/etc/php/conf.d/custom.ini \
&& echo "sendmail_path = sendmail -S mailhog:1025" >> /usr/local/etc/php/php.ini
RUN apt-get install - y sendmail
RUN usermod -u 1000 www-data
RUN chown 1000 /var/www -R
此Docker容器的正确配置是什么?
答案 0 :(得分:0)
我通过以下方法解决了此配置:
Dockerfile:
FROM prestashop/prestashop:1.6.1.16
RUN apt-get update && apt-get install -q -y ssmtp mailutils && rm -rf /var/lib/apt/lists/*
RUN echo "hostname=localhost.localdomain" > /etc/ssmtp/ssmtp.conf
RUN echo "root=root@presta.com" >> /etc/ssmtp/ssmtp.conf
RUN echo "mailhub=mailhog:1025" >> /etc/ssmtp/ssmtp.conf
RUN yes | pecl install xdebug-2.5.5 \
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.remote_connect_back=on" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.remote_port=9000" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "file_uploads=On" >> /usr/local/etc/php/conf.d/uploads.ini \
&& echo "memory_limit=128M" >> /usr/local/etc/php/conf.d/uploads.ini \
&& echo "upload_max_filesize=64M" >> /usr/local/etc/php/conf.d/uploads.ini \
&& echo "post_max_size=64M" >> /usr/local/etc/php/conf.d/uploads.ini \
&& echo "max_execution_time=600" >> /usr/local/etc/php/conf.d/uploads.ini \
&& echo "max_input_vars=10000" >> /usr/local/etc/php/conf.d/custom.ini \
&& echo "error_reporting-1" >> /usr/local/etc/php/conf.d/custom.ini \
&& echo "display_errors = On" >> /usr/local/etc/php/conf.d/custom.ini \
&& echo "sendmail_path=/usr/sbin/ssmtp -t" >> /usr/local/etc/php/conf.d/php-sendmail.ini
RUN echo "localhost localhost.localdomain" >> /etc/hosts
RUN usermod -u 1000 www-data
RUN chown 1000 /var/www -R
docker-compose.yml
version: '3'
services:
mysql:
image: mysql:5.7
restart: always
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=prestashop
volumes:
- ./data:/var/lib/mysql
adminer:
image: adminer
restart: always
ports:
- 81:8080
prestashop:
container_name: prestashop
build: ./docker/prestashop
ports:
- 8080:80
links:
- mysql
depends_on:
- mysql
volumes:
- ./:/var/www/html
environment:
- PS_DEV_MODE=1
- DB_SERVER=mysql
- DB_USER=root
- DB_PASSWD=root
- DB_NAME=prestashop
- PS_INSTALL_AUTO=
mailhog:
container_name: mailhog
image: mailhog/mailhog
restart: always
ports:
- 1025:1025
- 8025:8025