├── Dockerfile ├── README.md └── docker-compose.yml /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:5.6-apache 2 | 3 | MAINTAINER Collin Maessen “c.maessen@realskeptic.com” 4 | 5 | # Load extra Apache modules 6 | RUN a2enmod rewrite 7 | 8 | # Installs sendmail 9 | RUN apt-get update && apt-get install -q -y ssmtp mailutils && rm -rf /var/lib/apt/lists/* 10 | 11 | # Installs php modules 12 | RUN docker-php-ext-install mysql mysqli pdo pdo_mysql 13 | 14 | # set up sendmail config, see http://linux.die.net/man/5/ssmtp.conf for options 15 | RUN echo "hostname=localhost.localdomain" > /etc/ssmtp/ssmtp.conf 16 | RUN echo "root=c.maessen@realskeptic.com" >> /etc/ssmtp/ssmtp.conf 17 | RUN echo "mailhub=maildev" >> /etc/ssmtp/ssmtp.conf 18 | # The above 'maildev' is the name you used for the link command 19 | # in your docker-compose file or docker link command. 20 | # Docker automatically adds that name in the hosts file 21 | # of the container you're linking MailDev to. 22 | 23 | # Set up php sendmail config 24 | RUN echo "sendmail_path=sendmail -i -t" >> /usr/local/etc/php/conf.d/php-sendmail.ini 25 | 26 | # Fully qualified domain name configuration for sendmail on localhost. 27 | # Without this sendmail will not work. 28 | # This must match the value for 'hostname' field that you set in ssmtp.conf. 29 | RUN echo "localhost localhost.localdomain" >> /etc/hosts 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PHP with Sendmail example 2 | 3 | This is an docker example on how to get a php development stack with working sendmail running. Running the docker-compose command will set up a php container with apache, MariaDB container, phpMyAdmin container, and a MailDev container. 4 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | php: 2 | build: . 3 | links: 4 | - php_db:mysql 5 | - maildev:maildev 6 | ports: 7 | - 8080:80 8 | 9 | php_db: 10 | image: mariadb 11 | environment: 12 | MYSQL_ROOT_PASSWORD: examplepass 13 | 14 | phpmyadmin: 15 | image: phpmyadmin/phpmyadmin 16 | links: 17 | - php_db:db 18 | ports: 19 | - 8181:80 20 | environment: 21 | PMA_USER: root 22 | PMA_PASSWORD: examplepass 23 | PHP_UPLOAD_MAX_FILESIZE: 100MB 24 | 25 | maildev: 26 | image: djfarrelly/maildev 27 | ports: 28 | - 8282:80 29 | --------------------------------------------------------------------------------