Docker04 currently hosts all school websites in a developmental state. The entire web infrastructure is ran under Docker.

docker ps

CONTAINER ID        IMAGE                     COMMAND                  CREATED             STATUS              PORTS                                        NAMES  
0c0bd3b3eccc        psd/joomla:latest         "/tmp/setup.sh setup-"   16 minutes ago      Up 16 minutes       22/tcp, 0.0.0.0:5509->80/tcp                 hrm3x  
3772e771474a        psd/joomla:Feb            "/tmp/setup.sh setup-"   22 minutes ago      Up 22 minutes       22/tcp, 0.0.0.0:5501->80/tcp                 ves3x-test  
1c5533807708        psd/joomla:Feb            "/tmp/setup.sh setup-"   25 minutes ago      Up 25 minutes       22/tcp, 0.0.0.0:5511->80/tcp                 phs3x  
bff223915c6c        psd/samba                 "samba.sh -u www-data"   2 weeks ago         Up 2 weeks          0.0.0.0:139->139/tcp, 0.0.0.0:445->445/tcp   samba  
dc77b2cb36ea        psd/joomla:Jan            "/tmp/setup.sh setup-"   3 weeks ago         Up 3 weeks          22/tcp, 0.0.0.0:5503->80/tcp                 ees3x  
1314b9f97cf7        psd/joomla:Jan            "/tmp/setup.sh setup-"   3 weeks ago         Up 3 weeks          22/tcp, 0.0.0.0:5502->80/tcp                 vge3x  
92690b4f247f        psd/joomla:Jan            "/tmp/setup.sh setup-"   3 weeks ago         Up 3 weeks          22/tcp, 0.0.0.0:5504->80/tcp                 hhe3x  
dc203a3e79a3        psd/joomla:Jan            "/tmp/setup.sh setup-"   3 weeks ago         Up 3 weeks          22/tcp, 0.0.0.0:5505->80/tcp                 aes3x  
42803ae3bc3a        psd/joomla:Jan            "/tmp/setup.sh setup-"   3 weeks ago         Up 3 weeks          22/tcp, 0.0.0.0:5506->80/tcp                 des3x  
0ba348b62571        psd/joomla:Jan            "/tmp/setup.sh setup-"   3 weeks ago         Up 3 weeks          22/tcp, 0.0.0.0:5507->80/tcp                 pes3x  
706c1d7adc80        psd/joomla:Jan            "/tmp/setup.sh setup-"   3 weeks ago         Up 3 weeks          22/tcp, 0.0.0.0:5508->80/tcp                 gms3x  
1f935ae16c87        psd/joomla:Jan            "/tmp/setup.sh setup-"   3 weeks ago         Up 3 weeks          22/tcp, 0.0.0.0:5512->80/tcp                 ghh3x  
73d48e6301fa        psd/joomla:Jan            "/tmp/setup.sh setup-"   3 weeks ago         Up 3 weeks          22/tcp, 0.0.0.0:5514->80/tcp                 kms3x  
75d3964787dc        psd/joomla:Jan            "/tmp/setup.sh setup-"   3 weeks ago         Up 3 weeks          22/tcp, 0.0.0.0:5510->80/tcp                 kpm3x  
9fdd0e39efbd        psd/joomla:Jan            "/tmp/setup.sh setup-"   3 weeks ago         Up 3 weeks          22/tcp, 0.0.0.0:5515->80/tcp                 mes3x  
ffc3d84015c9        psd/joomla:Jan            "/tmp/setup.sh setup-"   3 weeks ago         Up 3 weeks          22/tcp, 0.0.0.0:5513->80/tcp                 hbh3x  
bbcc573a0479        dockermailrelay_postfix   "/root/run.sh"           3 months ago        Up 4 weeks          0.0.0.0:25->25/tcp                           mailrelay  

As you see, all sites are contained and quickly assessable. Here is an example docker-compose file that all these are powered by

/root/joomla-hrm3x/docker-compose.yml

joomla:  
  image: psd/joomla:latest
  ports:
    - "5509:80"
  container_name: hrm3x
  volumes:
    - ./vhosts:/var/www/vhosts/:rw
    - ./sites:/etc/nginx/sites-available:rw
  command: setup-joomla
  environment:
    - SERVER_NAME=hrm3x.psd401.net
  external_links:
    - mailrelay

Following the tree, "joomla" is simply just one container defined.

  • "image" attribute is the same across all websites, more on this later.
  • "ports" attribute is unique per site. See the docker ps output for an overview of ports.
  • "container_name" is important as it ties all docker commands to this container.
  • "volumes" attributes are where the essential files and configs are stored on the disk. vhosts is the entire Joomla install and sites are the required nginx configuration.
  • "environment" attributes are global system variables, the SERVER_NAME is used when running the image to setup php-fpm.
  • "external_links" attributes create a network connection to the mail relay container for mail transport.

Updating PHP

/root/joomla-docker/Dockerfile

.... Line 20
RUN apt-get -y --force-yes update  
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes software-properties-common


#ADDED for PHP 5.6 update
RUN add-apt-repository -y ppa:ondrej/php5-5.6; apt-get -y --force-yes update


RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes -q\  
  openssh-server nginx openssl supervisor\
  cron wget vim zip\
  php5-fpm php5 php5-cli php5-dev php-pear php5-common php5-apcu\
  php5-mcrypt php5-gd php5-mysql php5-curl php5-json\
  memcached php5-memcached\
  php5-imagick
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes php-apc  
RUN DEBIAN_FRONTEND=noninteractive apt-get upgrade -y --force-yes  
... More in file

Make the essential changes to the dependency installs. Installing php7 will require changing all the php5* to php7.0.

To build with the essential changes

cd /root/joomla-docker/  
docker build -t psd/joomla:Feb16 .  

To stay consistent name tag by Month/Year. Set your image as the latest image. Then run docker-compose up -d for a site and test to make sure it works.

  • Get the images
docker images  
  • Set the tag to your image
docker tag -f eb2531f85858 psd/joomla:latest  
  • Test a site with docker-compose
cd /root/joomla-hrm3x  
docker compose up -d  
  • Update all sites with the latest image
bash /root/compose-all.sh  

This will loop over all containers and run docker-compose up -d