Recently, after spending a big part of the day trapped in Kubernetes ecosystem YAML hell, I was desperate to get out of the house. I went to Faction Brewing, which is a local brewpub, for a beer and some tacos. But even there, I couldn’t escape from containers. The brewery is across the Oakland Estuary from the port of Oakland and off in the distance I could see a couple of cargo ships that were being loaded with containers. Not surprisingly, as I drank my beer, I started to think about the metaphorical origins of Docker containers
Docker containers draw their metaphorical inspiration from inter-modal shipping containers. As the excellent book The Box describes, shipping was inefficient, and expensive before the invention of inter-modal shipping containers. For example, in order to load a ship, longshore men had to manually load and stow tens of thousands cargo items of all shapes, sizes and weights, which was very labour intensive, and dangerous. Shipping containers revolutionized global trade. Goods are packaged and secured in containers of standardized sizes that are easily transported to and from ports and rapid loaded/unloaded from ships. This resulted in streamlined logistics and improved efficiency in global supply chains.
In the same way, Docker containers provide a standard way to package and run applications. Once an application has been packaged as a container image, its technology stack no longer matters. A container is created and managed regardless of whether it is, for example, a Java or GoLang application. Similarly, the details of the execution environment that runs the container are hidden from the application.
While it might appear that containers - shipping or Docker - are black boxes that can be treated uniformly, they have distinct characteristics that affect how they are handled.
Although a shipping container has a standardized size, it has various attributes that can influence where it is placed on a cargo shop Its weight is a critical concern since unless a ship has the correct weight distribution it might buckle or capsize. This requirement even affects the order in which containers are loaded onto a ship. Moreover, a shipping container has other attributes that determine placement such as power needs for refrigeration and whether its a fire hazard.
Similarly, Docker containers have attributes that affect where they are placed on the infrastructure. For example, the Kubernetes scheduler considers the following attributes when placing a container (strictly speaking a Pod, which is a collection of containers) on a node including the container’s resource requirements - CPU, memory, storage, etc., and constraints such as affinity and anti-affinity.
In addition to infrastructure-level attributes, a container typically has externalized configuration that is used to customize its behavior. For example, an application service needs to be configured with the location of a database. This configuration is typically provided via environment variables or configuration files.
To sum it up, shipping containers, which are the metaphorical inspiration for Docker containers, revolutionized global trade, while Docker containers revolutionized application packaging and deployment. Although they may seem like black boxes, both types of containers have unique attributes that impact their handling and placement. Shipping containers have attributes such as weight, power needs, and fire hazards, while Docker containers have attributes such as resource requirements, constraints on placement and externalized configuration.
One interesting historical fact is that the Port of San Francisco thought that containers were a passing fad where as Oakland embraced them. That’s why today container ships ignore San Francisco and sail to Oakland. An important reminder that it’s important to embrace change.
Microservices.io is brought to you by Chris Richardson. Experienced software architect, author of POJOs in Action, the creator of the original CloudFoundry.com, and the author of Microservices patterns.
Chris helps clients around the world adopt the microservice architecture through consulting engagements, and training workshops.
Chris teaches comprehensive workshops for architects and developers that will enable your organization use microservices effectively.
Avoid the pitfalls of adopting microservices and learn essential topics, such as service decomposition and design and how to refactor a monolith to microservices.Learn more
Chris offers numerous other resources for learning the microservice architecture.
Want to see an example? Check out Chris Richardson's example applications. See code
Got a specific microservice architecture-related question? For example:
Consider signing up for a two hour, highly focussed, consulting session.
My virtual bootcamp, distributed data patterns in a microservice architecture, is now open for enrollment!
It covers the key distributed data management patterns including Saga, API Composition, and CQRS.
It consists of video lectures, code labs, and a weekly ask-me-anything video conference repeated in multiple timezones.
The regular price is $395/person but use coupon MECNPWNR to sign up for $120 (valid until May 16th, 2023). There are deeper discounts for buying multiple seats.
Take a look at my Manning LiveProject that teaches you how to develop a service template and microservice chassis.
Engage Chris to create a microservices adoption roadmap and help you define your microservice architecture,
Use the Eventuate.io platform to tackle distributed data management challenges in your microservices architecture.
Eventuate is Chris's latest startup. It makes it easy to use the Saga pattern to manage transactions and the CQRS pattern to implement queries.
Engage Chris to conduct an architectural assessment.
Note: tagging is work-in-process
anti-patterns · application api · application architecture · architecting · architecture documentation · assemblage · beer · containers · dark energy and dark matter · deployment · design-time coupling · development · devops · docker · eventuate platform · glossary · hexagonal architecture · implementing commands · implementing queries · inter-service communication · kubernetes · loose coupling · microservice architecture · microservice chassis · microservices adoption · microservicesio updates · multi-architecture docker images · observability · pattern · refactoring to microservices · resilience · sagas · security · service api · service collaboration · service design · service discovery · service granularity · service template · software delivery metrics · success triangle · tacos · team topologies · transaction management · transactional messaging