Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tools:docker [2022/07/15 16:34] – [Docker] darrontools:docker [2022/07/17 16:11] (current) – [Resources] darron
Line 232: Line 232:
 </code> </code>
  
-===WordPress===+===WordPress development=== 
 + 
 +This is the process I used to develop a WordPress docker container. Following this is 
 +the method using a Dockerfile which automates the process once it is known. Some differences 
 +are also found in the application of the container during development.
  
 ==Proxy== ==Proxy==
Line 355: Line 359:
 </code> </code>
  
-===Docker file===+===WordPress Dockerfile===
  
 A docker file can be used to automate the building of an image after one A docker file can be used to automate the building of an image after one
 has been developed. has been developed.
  
-Example +Here is simple Makefile just used to contain various rules.
- +
-Create file called Dockerfile and add some commands.+
  
 <code> <code>
-FROM alpine:latest +clean
-RUN apk update +        rm -f *~
-ENTRYPOINT ["/bin/sh"+
-</code>+
  
-Build+build: 
 +        docker build --no-cache -t alpine_wp .
  
-<code> +run: 
-docker build -t alpine_test .+        docker run -d -t --net vlan --ip 10.44.0.11 --name wp-dev alpine_wp 
 + 
 +test: 
 +        curl -v http://10.44.0.11/ 
 + 
 +stop: 
 +        docker stop wp-dev 
 + 
 +rm: 
 +        docker rm -f wp-dev 
 +        docker image rm -f alpine_wp
 </code> </code>
  
-List+The Makefile uses a Dockerfile to make the build, as follows:
  
 <code> <code>
-docker image list alpine_test +# LATEST WORDPRESS ON ALPINE LINUX 
-REPOSITORY    TAG       IMAGE ID       CREATED         SIZE +FROM alpine:latest 
-alpine_test   latest    9b3d1a4beb97   5 minutes ago   7.99MB+# INSTALL APACHE2/PHP8 
 +RUN apk --no-cache update && apk --no-cache upgrade && apk --no-cache add php8 php8-apache2 php8-mysqli php8-mysqlnd php8-opcache php8-cli php8-ctype php8-iconv php8-session php8-simplexml php8-tokenizer php8-openssl php8-phar php8-curl php8-dom php8-exif php8-fileinfo php8-pecl-imagick php8-mbstring php8-zip php8-gd php-intl && ln -sf /usr/bin/php8 /usr/local/bin/php 
 +# INSTALL WORDPRESS 
 +WORKDIR /var/www/localhost/htdocs 
 +RUN wget -q "https://wordpress.org/latest.zip" && unzip -q latest.zip && rm latest.zip && chown -R apache:apache wordpress && rm -f index.html && echo "<?php header('Location: /wordpress/')?>" > index.php 
 +# START HTTPD 
 +EXPOSE 80 
 +ENTRYPOINT /usr/sbin/httpd -DFOREGROUND
 </code> </code>
  
Line 482: Line 500:
  
 [[https://docs.docker.com/get-started/|Docker HOWTO]] [[https://docs.docker.com/get-started/|Docker HOWTO]]
 +
 +[[https://docs.docker.com/develop/develop-images/dockerfile_best-practices/|Dockerfile Tips]]