Building your own containers

Image result for docker logo

One of the things I keep running into, not all the software I want to run has a good working docker container, ready for deployment. This is where docker is great. It takes little effort to find a base image that has all the prerequisites to create your own container to run any software. You can even start from scratch and just use a base OS in a container, like debian or ubuntu. Then just install the prereqs you need, and finish off with the software you want.

This makes docker great for testing and development, if you screw things up, just remove the container and pick up where you left off. Once you figure it out, you can take what you learned and build a dockerfile with all the commands you need to create an automated build. I ended up doing this a couple of times. I found the software I wanted to run, but couldn’t find any docker images of the latest versions, or simply couldn’t find an image anywhere.

ResourceSpace

Let’s look at ResourceSpace. Looks great. Love the idea, but the latest version I could find in docker hub was last pushed 2 years ago.
“Pushed” is the term for pushing you images to the registry, “pull” is the act of downloading the image, little tid bit for you.
I want the latest version of ResourceSpace, since the version in this image does not have the Google Vision plugin, which lets you run Facial and Test Recognition on all the images you upload. This feature is huge when you have hundreds of thousands of images an no metadata to tag them with. With this plugin, after Vision looks at the images, now you search for a purple brush, and only purple brushes come up in the search. All the text on the images also become searchable, product names, brand, net contents, descriptions, Google Vision grabs it all. So, we want this latest version. So, we take the dockerfile of the one last pushed 2 years ago, and change it. This one was pretty simple, just find where in the dockerfile they are downloading ResourceSpace, and change it so that it grabs the latest version. Happens right here:
RUN svn co http://svn.montala.net/svn/resourcespace .
With a bit of research, I find the latest releases here, and as I write this, it appears an even newer version is about to release. Nice! So, we change the old dockerfile by switching that RUN command to:
RUN svn co http://svn.resourcespace.com/svn/rs/releases/8.3/ .
I went ahead and did it from version 7.9 to 8.3, and made them automated builds in docker hub, thus giving back to the community. You can find them here.

Self Service Password

After setting up an OpenLDAP container, I soon realized, no one wants a generic password I force on them, and I don’t want to have to bother changing their passwords for them. I need a portal for my users to take control of their own passwords. I found a piece of software just for this, Self Service Password, but of course there was no docker image to be found. So, I had to build one. I don’t claim to be an expert on this, by the way… This took some searching for the right base image, one that had all the prerequisites needed. I found a well built Apache2 Image, with PHP and Ubuntu 14.04, nimmis/apache-php5, and built off this image. From here, just need to make sure all the prereqs are installed and top it off with our software. My First almost fully built image, creecros/openldap-selfservicepw.

The basic components to build a server

Testing and development

The first thing on our list, is a basic computer. For my server, I grabbed my old laptop. It’s about fifteen plus years old, and has an AMD Athlon X2 processor with 3 gigabytes of memory. We don’t need to worry about a working operating system, all we need to know is, does it turn on.

hp

Mine did turn on, and after about 30 mins, actually went into Windows Vista. Great! The next thing on our list, a working internet connection, it’s also probably wise to point out that our computer needs an ethernet port that works as well…I cannot imagine a computer that does not have this, but worth noting. I do, infact, have a working internet connection.

ether

Last but not least, we need an operating system. Since this blog is about building a dockerized server, the OS flavor is RancherOS. RancherOS is a great place to run Docker and Kubernetes. It’s an ultra-lightweight Linux distribution which enables you to boot Your containers in seconds as well as run Docker, Kubernetes and Rancher at Scale in production. If you want a simpler experience…choose your own flavor of linux…Image result for rancheros linux png

Production

After a few months of testing and learning, it was time to move what I learned into production. For this, I went with an HP ProLiant ML10 Gen9. Compared to my old laptop, which I still use, this was a monster of a machine. Cost was about $390 after taxes, brand new. I got a 6th gen quad core i3 Intel processor, 8gb of ram, and a 3TB hard drive. Pretty sure I also bought the last one, because it went discontinued after I bought it. Having figured out all I needed to know on my old laptop in regards to setup, I figured it would be a breeze to set this machine up, not so…

I ran into 2 issues I hadn’t yet experienced.

I couldn’t get the boot stick to be recognized, and this new machine refused to boot from it. I lost about a day figuring this one out, but apparently newer servers ship with UEFI boot and not the old BIOS that I am used to. After finally figuring this out, the problem was solved by going into the boot settings and switching to legacy boot. Now, I was booting to the stick and ready to start installing the OS.

There is a lot of configuration you need to do at this point, one of which involves putting an ssh-key into the config file before install. Problem is, the key is ridiculously long and could never be typed, and for the life of me I never figured out how to do this preinstall. Once you load the OS, you can copy paste the key, because after install, you are connecting to the machine through an ssh tunnel, so you can just create a key on one machine and then paste it into the config. I’d love to know how other people handle this one.

The second issue, RancherOS doesn’t want to install on a hard drive that is larger than 2TB. I wish it just said that…I couldn’t find a work around and refused to use a 3TB HDD as a 2TB and waiste all that space. My solution was sitting in an old machine I had in my attic, so I salvaged an old 80gb hard drive from a machine that hadn’t seen the light of day in 20 years, and viola…everything installed, and then I mounted the 3TB to the system. This works out better, it keeps the OS and images for the containers on a seperate HD, and I can now backup the images to another HD, as well as keep all the data seperate from the OS HD.