Docker container: Next Big Thing in Software Development 1/4

Software Development

Depending on what type of software product you are developing, the technologies involved. Even the architecture you are going to choose to perform this task, you will need to install and set up a bunch of different stuff in your machine and spend lots of hours, sleepless nights and sweat to come up with the “state of the art” software as the final result.

It’s also a common sense that every software product has its lifecycle, and it’s your responsibility to guarantee its evolution along with all the libraries, frameworks and many other pieces of software you tirelessly used to build it! It’s not fair that with all effort you have put into building software with all the invaluable skills of yours, you still have to deal with some inevitable environment issues caused by too much stuff cluttered on your computer!!

You might have caught yourself in this somewhat horrible situation during the application development at least once in your life as a developer, haven’t you?!

Hopefully, there is a solution to this, and the answer is a Docker container!!

A modern and versatile environment with Docker

How about building a modern and versatile software development environment with:

  1. Multiple operating systems, sharing their file systems (e.g. Linux, Windows, etc.)
  2. Version control (e.g. GitHub, Subversion, etc.)
  3. Multiple databases (e.g. Oracle, SQL Server, MySQL, Redis, MongoDB, etc.)
  4. Application Infrastructure (e.g. Node.js, Nginx, Apache HTTP Server Project, etc.)
  5. Software Runtime/Development Kit (e.g. Microsoft .NET, Java, etc.)
  6. Unit test and end-to-end automated web testing tools

All of that using one the most popular source code editor Visual Studio Code in your 16Gb RAM (recommended) machine!!

That’s what we are going to do, but first things first! There are some basic concepts we need to address here before we jump into a better software development environment.

docker container software development

What is Docker?

There are many definitions out there with, most of the time, a bunch of unnecessarily complicated terms, but here is the one I like the most: “It’s a tool designed to make it easier to create, deploy, and run applications by using a container.”

OK, but what is a docker container, though?

A container is a standard unit of software that packages up code and all its dependencies, so the application runs quickly and reliably from one computing environment to another. It is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings.

Now you know what Docker is, let’s make it happen!

There are two different versions of Docker, Enterprise Edition (Docker EE), which paid and Community Edition (Docker CE), the free one. Let’s stick with Docker CE.

There are many ways to install Docker. It’s possible to install it directly on Mac, Linux (CentOS, Fedora, Raspbian and Ubuntu) or Windows. For this series of posts, we are going to install Docker Desktop for Windows. You can follow the link, or you can follow me here for better convenience:

    1. You can either download the stable or edge version, it’s up to you, but it’s essential to be mindful about this.
      • Stable:
        • Stable is the best channel to use if you want a reliable platform to work. Stable releases track the Docker platform stable releases.
        • You can select whether to send usage statistics and other data.
        • Stable releases happen once per quarter.
      • Edge:
        • Use the Edge channel if you want to get experimental features faster and can weather some instability and bugs.
        • Always collect usage data on Edge releases.
        • Edge builds are released once per month.
    2. It takes less than 2 minutes, depending on your internet connection, to download the edge version, which is a little bit bigger (427Mb) than the stable (374Mb).
    3. Once downloaded, double-click Docker Desktop Installer executable to run the installer. If you are running a supported system, Docker Desktop prompts you to enable WSL 2 during installation. Read the information displayed on the screen and enable WSL 2 to continue.
    4. Open a command-line terminal like PowerShell or the very cool Windows Terminal, which I strongly recommend due its flexibility and versatility, and try out some Docker commands.
      • Run docker version to check the version. You should see something like this.

WindowsTerminalDockerVersion

      • Run docker run hello-world to verify that Docker can pull and run images and run the docker container. You should see the downloaded hello-world image like this.

WindowsTerminalHelloWorld

      • Run docker images hello-world. To see all docker images run docker images.

WindowsTerminalDockerImageHW

WSL2

You might have heard about WSL2! It is the second and better version of WSL (Windows Subsystem for Linux). The Windows Subsystem for Linux lets developers run a GNU/Linux environment — including most command-line tools, utilities, and applications — directly on Windows, unmodified, without the overhead of a traditional virtual machine or the dual-boot setup.

WSL2’s primary goals are to increase file system performance, as well as adding full system call compatibility

That’s excellent news for those who love working with Linux and lots of other freelancers developers in need of having multiple operating systems in their machines. Not to mention the fact that Linux and Windows are the most popular among developers, according to Stack Overflow’s last survey conducted in 2018.

Install the Windows Subsystem for Linux

The next steps are available in the official Windows Subsystem for Linux Installation Guide for Windows 10. Still, we are not installing version 1 of WSL, so that you can follow here for better convenience.

Pre-requisites to install WSL2:

  • Running Windows 10, updated to version 1903 or higher, Build 18362 or higher for x64 systems.
  • Running Windows 10, updated to version 2004 or higher, build 19041, for ARM64 systems.
  • Please note if you are on Windows 10 version 1903 or 1909, you will need to ensure that you have the proper backport; instructions can be found here.
  • Check your Windows version by selecting the Windows logo key + R, type winver, choose OK. (Or enter the ver command in Windows Command Prompt). Please update to the latest Windows version if your build is lower than 18361. Get Windows Update Assistant.

Before installing any Linux distributions on Windows, you must enable the “Windows Subsystem for Linux” optional feature.

Open PowerShell or Windows Terminal as Administrator and run:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

Before installing WSL 2, you must enable the “Virtual Machine Platform” optional feature.

Open PowerShell or Windows Terminal as Administrator and run:

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Restart your machine to complete the WSL 2 install.

Open PowerShell or Windows Terminal as Administrator and run this command to set WSL 2 as the default version when installing a new Linux distribution:

wsl --set-default-version 2

Install your Linux distribution of choice

    1. Open the Microsoft Store and select your favourite Linux distribution.Windows Microsoft Store The following links will open the Microsoft store page for each distribution:
  1. From the distribution’s page, select “Get”.Ubuntu

Set up a new distribution

The first time you launch a newly installed Linux distribution, a console window will open, and you’ll be asked to wait for a minute or two for files to de-compress and be stored on your PC. All future launches should take less than a second.

You will then need to create a user account and password for your new Linux distribution.

Ubuntu setup

Congratulations, you made it! You’ve just successfully started the first of 4 steps journey to have a great, flexible, versatile and tidy development environment.

Furthermore, at the end of this series, you will be able to run hybrid containerized apps in your software development environment. Maintain, test and deploy using databases, different operating systems and web servers in your machine effortlessly with the docker container concept.

Besides having all local development and deployment process covered in a rich cross-platform, you will be able to work with distributed applications, cloud environments, DevOps teams, other team members or even other development teams efficiently.

Docker came to replace conventional virtual machines as we know, and it’s the base to automate the deployment efficiently of the modern cloud computing environment. Furthermore, enterprise software must respond quickly to changing conditions. That means both easy scalings to achive demand and easy updating to add new features as the business demands.

Docker containers make it easy to introduce new versions of software, with new features, into production quickly – and to quickly roll back to a previous version if it is necessary. They also make it possible and easier to implement strategies like blue/green deployments.

Instances of containerized apps use much less memory than virtual machines, they start up and stop far more quickly, and they can be packed more densely on their host hardware environment. All of this amounts to less spending on the Information Technology department.

Do you want to know more about us and our mission, click here?

We also have pro bono projects just in case you are interested in learning more about them.

Be aware of why we started this project clicking here.

Learn more about other posts here.

Contact us for any suggestions. And follow us on Facebook, Instagram and Twitter.

If you are a good reader like myself, I recommend the following readings:

  1. Docker Quick Start Guide: Learn Docker like a boss, and finally own your applications
  2. Docker for Developers: Develop and run your application with Docker containers using DevOps tools for continuous delivery

See you in the next post!

2 Replies to “Docker container: Next Big Thing in Software Development 1/4”

Leave a Reply