Dev Container memory usage really high?

I’m on a M2 Macbook Pro using the Dev Container setup. Memory usage seems really high, is this typical? I see about 4GB memory usage before running anything, then needing about 10GB to get through a successful build and the full app running at about 8GB.

Before the official Dev Container config was shared, I had my own devcontainer.json that didn’t use the discourse_dev base image. It uses only 2GB RAM at rest and 6GB while running Discourse, so I’m curious what the difference could be.

base image: mcr.microsoft.com/devcontainers/base:debian-12
with these “features”:

	"features": {
		"ghcr.io/rocker-org/devcontainer-features/apt-packages:1": {
			"packages": "software-properties-common libpq-dev vim curl expect debconf-utils build-essential zlib1g-dev libssl-dev openssl libcurl4-openssl-dev libreadline6-dev libpcre3 libpcre3-dev imagemagick advancecomp jhead jpegoptim libjpeg-turbo-progs optipng pngcrush pngquant gnupg2"
		},
		"ghcr.io/devcontainers/features/ruby:1": {
			"version": "3.3.4"
		},
		"ghcr.io/devcontainers/features/node:1": {
			"version": "18",
			"pnpmVersion": "9"
		},
		"ghcr.io/devcontainers/features/rust:1": {
			"version": "1.75.0"
		},
		"ghcr.io/itsmechlark/features/redis-server:1": {},
		"ghcr.io/devcontainers/features/go:1": {},
		"ghcr.io/azutake/devcontainer-features/go-packages-install:0": {
			"PACKAGES": "github.com/mailhog/MailHog@latest"
		},
	},	

including another container db service running the postgres:14 image

The official image aims to simplify development by bundling everything needed to run Discourse seamlessly, at the cost of higher memory requirements, and your custom setup seems to have a fine-grained control over versions and installed libraries.

Are you also seeing the dev image using about 8-10GB RAM?

Now it’s down around 6GB after restarting all the things, so I am going to assume that is “typical” and blame any more than that on a possible memory leak somewhere in the dev stack (probably Docker Desktop).

2 Likes