Skip to content

Instantly share code, notes, and snippets.

Container Design Patterns

1. The single-container design pattern

Employing the single-container pattern means just putting your application into a container. It's how you usually start your container journey. But it's important to keep in mind that this pattern is all about simplicity, meaning that the container must have only one responsibility. That means it's an anti-pattern to have a web server and a log processor in the same container.

Containers are commonly used for web apps, where you expose an HTTP endpoint. But they can be used for many different things.

In Docker, you have the ability to change the behavior of a container at runtime, thanks to the CMD and ENTRYPOINT instructions. So I'm not limited to using containers for HTTP services. I can also use them for any bash script that accepts some parameters at runtime.

By letting containers change behavior at runtime, you can create a base container that can be reused in different contexts. So you'd use the single-container pattern to expose

@shivai
shivai / bash_strict_mode.md
Created November 3, 2022 20:35 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation