--- title: "Zero to Wordpress on Docker in 5 Minutes" tags: date: "2014-05-10" published: false ---
sqlite
rather than mysql
. Considering
all of this here is the basic recipe for wordpress:
apache
and php.
FROM goldmann/f20 MAINTAINER Dusty Mabe# Install httpd and update openssl RUN yum install -y httpd openssl unzip php php-pdo # Download and extract wordpress RUN curl -o wordpress.tar.gz http://wordpress.org/latest.tar.gz RUN tar -xzvf wordpress.tar.gz --strip-components=1 --directory /var/www/html/ RUN rm wordpress.tar.gz # Download plugin to allow WP to use sqlite # http://wordpress.org/plugins/sqlite-integration/installation/ # - Move sqlite-integration folder to wordpress/wp-content/plugins folder. # - Copy db.php file in sqlite-integratin folder to wordpress/wp-content folder. # - Rename wordpress/wp-config-sample.php to wordpress/wp-config.php. # RUN curl -o sqlite-plugin.zip http://downloads.wordpress.org/plugin/sqlite-integration.1.6.3.zip RUN unzip sqlite-plugin.zip -d /var/www/html/wp-content/plugins/ RUN rm sqlite-plugin.zip RUN cp /var/www/html/wp-content/{plugins/sqlite-integration/db.php,} RUN cp /var/www/html/{wp-config-sample.php,wp-config.php} # # Fix permissions on all of the files RUN chown -R apache /var/www/html/ RUN chgrp -R apache /var/www/html/ # # Update keys/salts in wp-config for security RUN \ RE='put your unique phrase here'; \ for i in {1..8}; do \ KEY=$(openssl rand -base64 40); \ sed -i "0,/$RE/s|$RE|$KEY|" /var/www/html/wp-config.php; \ done; # # Expose port 80 and set httpd as our entrypoint EXPOSE 80 ENTRYPOINT ["/usr/sbin/httpd"] CMD ["-D", "FOREGROUND"]
docker build
and then run the new container with the
docker run
command. An example of these two commands is shown
below:
[root@localhost ~]# ls Dockerfile Dockerfile [root@localhost ~]# docker build -t "wordpress" . ... Successfully built 0b388013905e ... [root@localhost ~]# [root@localhost ~]# docker run -d -p 8080:80 -t wordpress 6da59c864d35bb0bb6043c09eb8b1128b2c1cb91f7fa456156df4a0a22f271b0
docker build
command will build an image from the Dockerfile
and then tag the new image with the "wordpress" tag. The docker run
command will run a new container based on the "wordpress" image and bind
port 8080 from the host machine to port 80 within the container.