It has been a long while ago I logged on a linux console and played around to install some packages. Currently working on a course for “Developing Microsoft Azure Solutions (70-532)” where I learned what DevTest Labs is and spin off an Ubuntu server image with the Docker package (as artifact option). I like this concept around DevTest principle to create images, configure and make them available to developers, IT or the end users to test the applications.
Ubuntu server was running and I could connect with SSH to it. So I did and now I needed to find my way around. It all worked out with help from google to find the proper command set to get my WordPress site up and running. I knew what docker was and wanted to get it working myself.
Install and configure mysql database engine and load WordPress
#update Ubuntu and verify docker is working sudo apt-get update sudo docker run hello-world #restart docker daemon sudo service docker restart #create wordpress folder mkdir ~/wordpress && cd ~/wordpress #install mariadb engine for mysql sudo docker run -e MYSQL_ROOT_PASSWORD=1234567ABC -e MYSQL_DATABASE=wordpress --name wordpressdb -v "$PWD/database":/var/lib/mysql -d mariadb:latest #verify the mariadb container sudo docker ps #download wordpress container sudo docker pull wordpress #run wordpress container, make sure to use right tcp port (8080 is the one I will be creating NAT rule to my Ubuntu server) sudo docker run -e WORDPRESS_DB_PASSWORD=1234567ABC --name wordpress --link wordpressdb:mysql -p 8080:80 -v "$PWD/html":/var/www/html -d wordpress
I completed the steps above and tried to connect to the Ubuntu server over tcp/8080 port. After some additional reading on google and finding my way in the DevTest Lab resources I figured out I need to create additional inbound NAT rule and point that to my VM and the 8080 port I configured in the “sudo docker run with option –p”
I run following command to verify local connectivity from the Ubuntu server
curl -I 10.0.0.4:8080
@UbuntuServer:~$ curl -I 10.0.0.4:8080 HTTP/1.1 301 Moved Permanently Date: Fri, 17 Nov 2017 09:49:13 GMT Server: Apache/2.4.10 (Debian) X-Powered-By: PHP/5.6.32 Location: http://ubuntu1234.westeurope.cloudapp.azure.com:8080/ Content-Type: text/html; charset=UTF-8 @UbuntuServer:~$
Output looks good and so I opened IE and followed the steps for WordPress installation of a new site.
One thing that I learned is when installing the containers for docker you will need to update the restart option of the container, otherwise after server reboot the containers won’t run. I run the following two commands and fixed that problem.
sudo docker update --restart always wordpressdb sudo docker update --restart always wordpress
From now on I will maintain my own Ubuntu server ,continue to explore docker containers and refresh my linux knowledge.