Run My Container — Docker and the Super Powers of FROM!

Containerized applications and services are very hyped. Perhaps not at the same level as in 2015, but some say it's the future.

As usual the attention goes to everything but the core of what you do, and what you need. But instead focus is on everything around it. The tools and the cool things the tools can do, and not so much what you are actually building.

As if we as developers, don't care about what we create for our customers, and instead have to make the tools and methodologies the appealing objective of our work.

Anyway, as glory as Kubernetes sounds - or k8s, sorry - it is a dreadful undertaking to configure and manage, especially if Docker and containerization is already a mouthful, and you just need to run a small container that does some magic a little outside the stack of your choice.

One of the strengths of Docker is the ability to wrap code into a pre-configured OS, that you can run on many hosts, without worrying about deployment.

It's also a great way to run open source projects, as many come with pre-built images that are ready to run. I don't have any idea on how to set up a PHP application to run with SSL certificates and such "great stuff", but running a container is much more accessible. Theoretically at least.

Docker interest follows public clouds

Interest in Docker as a measure of search over time, follows the same pattern as AWS and Azure.

Not just hype, after all then.

Just run my damn container!

A Dockerfile and some application code that sits in a git repo, is the purest form of digital value that you can get.

From nothing you apply knowledge to problems in the form of code, which will add value when run.

Setting up infrastructure is an investment – a distraction even, from the purity of solving problems with code. You just want it to run and work as intended.

Bringing down your own infrastructure footprint to a Dockerfile, and letting someone else live with the hassle of provisioning servers, networking, security and all that, allows you to focus on what really matters: building great things for your customers.

So all you really want is a very simple way to just run your damn container, just how your code is build by virtue of continious integraiton. It just works.

Containers are the abstraction layer of a fragmented world

Virtual machines, then cloud brought us scalability we hadn't seen before. Compute was suddenly just a few clicks away, and they kept you away from the dreadful experience of the server room.

But for what it was worth, a virtual machine is just the compute. You still have the exact same OS to prepare and secure to match your use case.

Furthermore, cloud providers such as Amazon (AWS), Microsoft (Azure) and Google (Cloud Platform) bring their own vendor specific lock-in, in the name of convenience, which can catch you by surprise at a later stage if you decide to change direction — lots of these services are great, I'm not advocating against using them, you just have to be aware of the lock-in that you're signing up for.

But containers are versatile and allows you to code your OS along with your app or service, then have it run somewhere without the vendor specific details. If you figure out you can save money with a different cloud provider, you can move your container there without much need to adjustments.

Use FROM to inherit an entire OS

FROM is your new super power!

At the core of the Dockerfile is the FROM command, which as the name implies, will start out FROM another image.

Consider FROM ubuntu:latest — here we take the entire Ubuntu OS as a starting point, and then apply customizations on top. You may want to apt-get install several dependencies, clone a git repo and install Python packages that you depend on.

But back to running your container...

Azure Container Instances — Undervalued!

Microsoft Azure offers a service for running containers: Azure Container Instances which lets you run a container, without the hassle of servers and infrastructure.

It is insanely undervalued in my opinion...

You simply manage the OS in the Dockerfile.

If you don't want to create a Dockerfile and build it to a runnable container, you can use any public containers on Docker Hub, for example, the Ubuntu:latest image which lets you get started with Ubuntu really fast.

Or you can go with some of the preview images, offered in the Azure Portal:

Preview images, easy to get started, but not very useful 😂

Per second billing

The form above is what it takes to spin up a container. Nothing else.

The great part is that you only pay for the compute, and it is billed per second! Only need this container to run a Python job for 7½ minutes? You only pay for that exact time, no minimum charges or costs to provisioning resources.

Martin H. Normark

Martin H. Normark

Product and UX Hacker. Web and iOS developer.
Denmark