Skip to content

Instantly share code, notes, and snippets.

Mistakes to Avoid: Docker Antipatterns

Whichever route you take to implementing containers, you’ll want to steer clear of common pitfalls that can undermine the efficiency of your Docker stack.

Don’t run too many processes inside a single container

The beauty of containers—and an advantage of containers over virtual machines—is that it is easy to make multiple containers interact with one another in order to compose a complete application. There is no need to run a full application inside a single container. Instead, break your application down as much as possible into discrete services, and distribute services across multiple containers. This maximizes flexibility and reliability.

Don’t install operating systems inside Docker containers

It is possible to install a complete Linux operating system inside a container. In most cases, however, this is not necessary. If your goal is to host just a single application or part of an application in the container, you need to install only the essential

@zhangguangyan
zhangguangyan / docker-for-mac.md
Created September 29, 2023 10:16 — forked from BretFisher/docker-for-mac.md
Getting a Shell in the Docker Desktop Mac VM

2021 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Docker VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1


guangyanzhang@Guangyans-MacBook-Pro:~/repo/k8s/sandbox $ brew reinstall node@12
==> Reinstalling node@12 
==> Downloading https://homebrew.bintray.com/bottles/[email protected]
Already downloaded: /Users/guangyanzhang/Library/Caches/Homebrew/downloads/3dbcdcae28077cf3753382ca29384e98c296636dc481c0a6a4f72afb5b3d29ff--node@12-12.13.0.catalina.bottle.tar.gz
==> Pouring [email protected]
==> Caveats
node@12 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.
@zhangguangyan
zhangguangyan / gist:5c74e94b21384dd3506a96f7a19e16d7
Last active March 29, 2019 22:50
jackson deserialization without annotation (metadata)

jackson version: 2.9.8

package z.jack;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.ObjectCodec;
import com.fasterxml.jackson.core.TreeNode;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;