April 28, 2018

Setting up Ubuntu Linux with Docker

Let's say that I only have a Windows 10 system at home, and I wanted to take a refresher course, Michael Hartl's Learn Enough Command Line to Be Dangerous. There are many ways to get Linux on a Windows machine. The easiest I found? Docker. Besides, they use Docker at work, so I need to practice that, too.

There are some technologies that keep on popping up again and again in my short career as an automation developer. One of those is Docker. "Docker is a software platform that allows you to build, test, and deploy applications quickly. Docker packages software into standardized units called containers that have everything the software needs to run including libraries, system tools, code, and runtime", according to AWS's article, What is Docker?

Back in July 2016, I was doing some weekend work to see if my company might be able to set up Docker with the new Docker Toolbox, with me working with our DevOps team, implementing a Selenium Grid using Docker-Selenium to possibly offload some of the cost of Sauce Labs, which can get pricey. I was inspired by a Selenium Conf India 2016 talk, "Testing as a Container". The month before, I was also tinkering with Setting up a Virtual DEV environment with VirtualBox, Vagrant and Docker, based on a Test Driven Java Development book I was reading. The projects were nixed, and I moved onto other things.

Years later, in March 2018, I would revisit this project, Starting a Selenium Grid using AWS + SeleniumHQ Docker images and Docker Compose.

That's how it goes jumping from gig to gig the past few years: from workplace to workplace the technology stack changes. Hopefully with my current full time permanent gig I can stop tinkering, settle down for five or six years and actually get good at some of this stuff, instead of always feeling that I am paging through the book "How To Skydive" while I am in free fall.

With this blog article we are not doing anything so fancy. All I want to do is bring up a Docker image containing Ubuntu. You see, as much as I love my work Macbook, at home I always use a Windows machine. Every few months I am tinkering with a new tool or technology, installing the Windows version of whatever I am tinkering with. It gets cluttered with half-forgotten tools. Maybe if I use Docker, I can start using a real Linux environment while at home instead of the half-baked hybrid I have been using.

Yeah, I could Start a Linux Machine with Amazon Web Services Free Tier, which I researched back in January of 2018 ... but between you and me, I worry about leaving a process running, and being stuck with a hefty monthly bill. Luckily, Docker for Windows would work just as easily!

Docker Community Edition

Installing Docker Community Edition is easy! Just go to the Docker installation page, and select the installation executable. For the record, I installed Docker 18.03.1-ce-win64.

It also helps if you create a free Docker account at https://cloud.docker.com/ ... that way, you can access pre-built Docker images on https://hub.docker.com/explore/ such as the one for Ubuntu.

What is Ubuntu?

"Ubuntu is a Debian-based Linux operating system, with Unity as its default desktop environment. It is based on free software and named after the Southern African philosophy of ubuntu (literally, 'human-ness'), which often is translated as 'humanity towards others' or 'the belief in a universal bond of sharing that connects all humanity'.

"Development of Ubuntu is led by UK-based Canonical Ltd., a company owned by South African entrepreneur Mark Shuttleworth. Canonical generates revenue through the sale of technical support and other services related to Ubuntu. The Ubuntu project is publicly committed to the principles of open-source software development; people are encouraged to use free software, study how it works, improve upon it, and distribute it".

Ubuntu is the most referenced Linux distro I have seen at the cloud-based security and intrusion detection company I work at. More information is at the official Ubuntu website, https://www.ubuntu.com/about.

How Do We Get Ubuntu?

Once Docker for Windows is installed, it is fully integrated in your MS DOS Command Prompt. Try the following commands after installation:
  • To check to make sure that Docker is installed, type in: docker -v
  • To install Ubuntu, follow the instructions in the Ubuntu Docker Image: docker pull ubuntu
  • Now that we have the Docker image we can run a container based on this image and log in: docker run -it ubuntu
That is all it takes to enter the bash shell of the Ubuntu image. Right in the MS-DOS prompt, we are running Linux! 
  • To exit Ubuntu Linux, enter: exit
Now you can follow along with Learn Enough Command Line to Be Dangerous.

How Do We Learn Docker?

Need more tips how to learn Docker? I was going to go through the Play with Docker Classroom, which covers: 

Stage 1: The Basics

"This stage will teach you the basics. Topics include:
  • "Get you familiar with the core concepts of Docker
  • "Show you how to build and deploy multi-service applications

Stage 2: Digging Deeper

"This stage show you how to incorporate Docker into your entire developer workflow. Topics include:
  • "Use Docker with various IDEs
  • "Get started with Windows containers
  • "Preparing your workflow"

Stage 3: Moving to Staging

Happy Testing!

-T.J. Maher
Sr. QA Engineer, Software Engineer in Test
Meetup Organizer, Ministry of Testing - Boston

Twitter | YouTubeLinkedIn | Articles


John said...

I have windows 8 installed on my PC and it is still going just fine which is why I don’t need to install a new one. I can do everything from my existing windows like buying academic assistance from https://paytotakemyclassonline.com/take-my-online-class-for-me/
to attend my class online or assignment writing services from an online platform.

Embroidery Digitizing Services said...

Configuring Ubuntu Linux with Docker is a gateway to a world of streamlined development and deployment. This setup combines the robustness of Ubuntu with Docker's containerization prowess, offering a scalable and efficient environment for applications. By harnessing Ubuntu's stability and Docker's agility, developers gain a versatile platform to build, test, and deploy software seamlessly. It's a game-changer, simplifying complex processes and fostering innovation in the realm of software development, making the union of Ubuntu Linux and Docker an invaluable asset for modern tech enthusiasts.