Skip to main content

Building Container Images

Hands-On Lab

 

Photo of joel

joel

Training Architect

Length

00:30:00

Difficulty

Beginner

Welcome back! President Squawk extends his deep gratitude for your assistance with launching the SpaceBones website in the previous activity using the existing image provided, but as a Red Hat Fanbird he has requested that the site be migrated to an RPM environment -- specifically CentOS 6. Because of your stellar performance so far, The President has requested that you handle the migration & create a new image.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

In this activity, you are tasked with migrating the SpaceBones official Government website from Ubuntu to CentOS 6 by preparing a CentOS 6 image found on DockerHub to run Apache. Use the website contents found in the content-dockerquest-spacebones GitHub repository (specifically contents found under the /doge/ directory) to recreate the website on CentOS. Good luck!

After logging into your server, pull the centos:6 Docker image

docker pull centos:6

Once the pull completes, start the Docker container in interactive mode, name it 'websetup'.

docker run -it --name websetup centos:6 /bin/bash

Update the system, then install Apache & Git.

yum -y update
yum -y install httpd git

Once installation completes, clone the content-dockerquest-spacebones repository, then copy the contents of the /doge/ subdirectory to /var/www/html.

git clone https://github.com/linuxacademy/content-dockerquest-spacebones
cp content-dockerquest-spacebones/doge/* /var/www/html

In order for the site to display correctly, rename the default welcome.conf file to welcome.conf.bak.

mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf.bak

Enable & start the Apache service, then exit the container environment by typing exit or hitting CTRL+C.

chkconfig httpd on && service httpd start
exit

Save the edited image, then pat yourself on the back for being awesome.

docker commit websetup spacebones:thewebsite