silintl/php7
PHP7 with Apache running on Ubuntu
10K+
I created this Docker image to start testing our apps with PHP7.
If I did not include a module or something you need let me know by
creating an issue or submitting a pull request. You'll notice I
removed the default site so I could load in my own vhost config,
so when you extend this you'll probably want to use ADD
or
COPY
to put a file into /etc/apache2/sites-enabled
.
A full tutorial on using Docker is way beyond the scope of this quick guide, but I'm happy to incorporate suggestions on how to make this more thorough and easy for people to get started with.
boot2docker up
. You'll also need
to setup your shell to know how to talk to the Docker host on
Mac/Win, on Mac this looks like running $(boot2docker shellinit)
which will load the Docker host environment variables into your
session to make it easier to interact with.docker pull silintl/php7
docker build -t="namespace/app-name" .
docker run -d -P namespace/app-name
You can check if your
container is running by running docker ps
and see what port
80 got mapped to. Then you should be able to access your application
in your browser by going to http://(DOCKER-IP-HERE):port
FROM silintl/php7
MAINTAINER Your Name <your_email@domain.com>
ENV REFRESHED_AT 2015-05-11
# Copy an Apache vhost file into sites-enabled. This should map
# the document root to whatever is right for your app
COPY vhost-config.conf /etc/apache2/sites-enabled/
RUN mkdir -p /data
VOLUME ["/data"]
# Copy your application source into the image
COPY application/ /data/
WORKDIR /data
EXPOSE 80
CMD ["apache2ctl", "-D", "FOREGROUND"]
<VirtualHost *:80>
ServerName myapp.local
DocumentRoot /data/frontend/web/
#RewriteEngine On
DirectoryIndex index.php
<Directory /data/frontend/web/>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
LogLevel info
ErrorLog /var/log/apache2/myapp-error.log
CustomLog /var/log/apache2/myapp-access.log combined
</VirtualHost>
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
docker pull silintl/php7