CMS Container Management

Concept

WordPress is a great tool for building and updating a website quickly and easily.   The general problem for WordPress is the dynamic nature of the PHP code requires long-running resources that don’t scale well for the workload.  This post is dedicated to providing an example for managing the lifecycle of the WordPress CMS container in use.

Requirements

This document expects that you have the CMS docker container up and running.  For information on this click here.

This document expects that you have the CnC docker container up and running for instructions please click here.

Saving Containers

From the Command and Control container prompt it is easy to save the CMS you have been working with.  Simplify run save-cms cmsname.  As shown in the below code block.

[email protected]:~/]$ save-cms examplecms
sha256:8c957bcd65f4701cc687cab1619d9489b711aeb0fa5f4cea330f61743a3fe813
e77945fac8ac
e77945fac8ac
    Save completed successfully
[email protected]:~/]$

Starting a saved CMS

From the Command and Control container prompt it is easy to save the CMS you have been working with.  Simply run start-cms cmsname.  As shown in the below code block.

[email protected]:~/]$ start-cms examplecms
0faf59faed4dd5e8555c410bf55a7060186f1824e4c9cf020b7f518b61d2f1f0
    CMS Started
[email protected]:~/]$

Backing up

To backup your CMS container you need a repository to push it to.  Docker hub provides 1 free private container per account.  To setup, a docker hub account click here.

Once you have your docker hub setup.  Login by running docker login, as shown in the code block below.

[email protected]:~/]$ docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: examplecms
Password:
Login Succeeded
[email protected]:~/]$

Once you are logged in you need to re-tag your cms.  You do this by looking up the image-id of your CMS.  I have provided a script to simply this, just run cms-get-id $cms_name.  As demonstrated in the code block below.

[email protected]:~/]$ cms-get-id examplecms
8c957bcd65f4
[email protected]:~/]$

With the id, we can tag the container for the account we created in docker hub.

[email protected]:~/]$ docker tag 8c957bcd65f4 examplecms/my-cms-rocks:latest
[email protected]:~/]$

Now that we have our container tagged we can push it to our repo.  This is done by running docker push $tag, demonstrated in the code block below.

[email protected]:~/]$ docker push examplecms/my-cms-rocks:latest
The push refers to a repository [docker.io/examplecms/my-cms-rocks]
8c62a65c6356: Pushed
78998b1b932c: Pushed
e937cd598f8d: Pushed
938964244e81: Pushed
2ede6bdd98b8: Mounted from tmb28054/rpi-apache-php
aeadbc258a19: Pushed
85952b2b2987: Pushed
b6f6cfed7d6a: Pushed
8e8ea84736e4: Pushed
74375055d6b5: Pushed
b7c10b94b4de: Pushed
51bc9e4a7bc2: Pushed
071616de62bc: Pushed
49907af65b0a: Mounted from library/ubuntu
4589f96366e6: Mounted from library/ubuntu
b97229212d30: Mounted from library/ubuntu
cd181336f142: Mounted from library/ubuntu
0f5ff0cf6a1c: Mounted from library/ubuntu
latest: digest: sha256:ba22731b5b00d71185ff22a6fae6b681b9e9860b93359dc058f0dc0b8c3d4d5f size: 4091
[email protected]:~/]$

What Next?

At this point, the CMS is backed up.  Our work isn’t done, you decide what to take on next.

  1. Publish WordPress CMS to S3.
  2. Configuring a WordPress Content Management System.