Sie sind auf Seite 1von 8

Create PHP-MySQL-Apache Development Environment using Docker https://medium.com/@meeramarygeorge/create-php-mysql-apache-deve...

1 of 8 09/11/2018, 8:21
Create PHP-MySQL-Apache Development Environment using Docker https://medium.com/@meeramarygeorge/create-php-mysql-apache-deve...

FROM ubuntu:latest

MAINTAINER Name<email>

ENV DEBIAN_FRONTEND noninteractive

# Install basics

RUN apt-get update

RUN apt-get install -y software-properties-common && \

add-apt-repository ppa:ondrej/php && apt-get update

RUN apt-get install -y — force-yes curl

2 of 8 09/11/2018, 8:21
Create PHP-MySQL-Apache Development Environment using Docker https://medium.com/@meeramarygeorge/create-php-mysql-apache-deve...

# Install PHP 5.6

RUN apt-get install -y — allow-unauthenticated php5.6


php5.6-mysql php5.6-mcrypt php5.6-cli php5.6-gd php5.6-curl

# Enable apache mods.

RUN a2enmod php5.6

RUN a2enmod rewrite

# Update the PHP.ini file, enable <? ?> tags and quieten
logging.

RUN sed -i “s/short_open_tag = Off/short_open_tag = On/”


/etc/php/5.6/apache2/php.ini

RUN sed -i “s/error_reporting = .*$/error_reporting =


E_ERROR | E_WARNING | E_PARSE/” /etc/php/5.6/apache2/php.ini

# Manually set up the apache environment variables

ENV APACHE_LOG_DIR /var/log/apache2

ENV APACHE_LOCK_DIR /var/lock/apache2

ENV APACHE_PID_FILE /var/run/apache2.pid

# Expose apache.

EXPOSE 80

EXPOSE 8080

EXPOSE 443

EXPOSE 3306

# Update the default apache site with the config we created.

ADD apache-config.conf /etc/apache2/sites-enabled/000-


default.conf

# By default start up apache in the foreground, override


with /bin/bash for interative.

3 of 8 09/11/2018, 8:21
Create PHP-MySQL-Apache Development Environment using Docker https://medium.com/@meeramarygeorge/create-php-mysql-apache-deve...

CMD /usr/sbin/apache2ctl -D FOREGROUND

<VirtualHost *:80>

ServerAdmin me@mydomain.com

DocumentRoot /var/www/Website

<Directory /var/www/Website/>

Options Indexes FollowSymLinks MultiViews

AllowOverride All

Order deny,allow

Allow from all

</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

4 of 8 09/11/2018, 8:21
Create PHP-MySQL-Apache Development Environment using Docker https://medium.com/@meeramarygeorge/create-php-mysql-apache-deve...

C: Drive

----> Users

-----> mgeorge

------> Website

-------> Dockerfile, apache-config.conf

docker build -t <image_name> .

docker run -p 8080:80 -d -v /c/Users/mgeorge/Website:


/var/www/Website — name <container_name> <image_name>

5 of 8 09/11/2018, 8:21
Create PHP-MySQL-Apache Development Environment using Docker https://medium.com/@meeramarygeorge/create-php-mysql-apache-deve...

docker exec -it <container_name> bash

http://<docker-host-ip-address>:8080

grant all privileges on *. * to ‘username’@’%’ identified by


‘password’;

flush privileges;

6 of 8 09/11/2018, 8:21
Create PHP-MySQL-Apache Development Environment using Docker https://medium.com/@meeramarygeorge/create-php-mysql-apache-deve...

7 of 8 09/11/2018, 8:21
Create PHP-MySQL-Apache Development Environment using Docker https://medium.com/@meeramarygeorge/create-php-mysql-apache-deve...

8 of 8 09/11/2018, 8:21

Das könnte Ihnen auch gefallen