How Much RAM Do You Need for Docker + AI + VS Code?
Learn how to measure and plan RAM for Docker, local AI models, and VS Code with practical commands and a recommended setup.
The problem: your laptop is swapping, and you don't know why
You open VS Code, spin up a Docker container, and try to run a local LLM. Within minutes, the fan spins up, the UI stutters, and your machine starts swapping to disk. You check Activity Monitor or Task Manager: RAM usage is pegged at 100 percent.
The real question is not 'how much RAM does the internet say I need?' It is 'how much RAM does my specific workload actually consume?' In this article, I will show you how to measure that precisely, then give you a recommended setup that balances cost and performance.
I will walk through a real scenario: running Docker Desktop, VS Code with a few extensions, and a local AI model (like Llama 3.2 or Mistral 7B) on a developer laptop. You will learn to measure baseline usage, estimate model memory, and configure Docker and VS Code to stay within your RAM budget.
Before you start: what you need
You need a machine with Docker installed (Docker Desktop on macOS/Windows, or Docker Engine on Linux) and VS Code. For measuring RAM, you will use built-in OS tools and a small script.
This guide assumes you are comfortable with the terminal. All commands are copy-paste ready. If you are on Windows, use PowerShell or WSL2; on macOS or Linux, use Terminal.
- Docker Desktop or Docker Engine (version 20.10 or later)
- VS Code (latest stable)
- A terminal (bash, zsh, or PowerShell)
- Optional: Python 3.8+ for the memory estimation script
- At least 16 GB of RAM on your machine (we will verify if that is enough)
Step 1: Measure your baseline RAM usage
Before adding Docker or AI, measure how much RAM your OS and typical apps consume. This gives you a baseline. On macOS, use the vm_stat command; on Linux, use free -h; on Windows, use Get-Counter.
Run the appropriate command for your OS to see current memory pressure.
# macOS
vm_stat | head -20
# Linux
free -h
# Windows PowerShell
Get-Counter '\Memory\Available MBytes'- Note the 'available' or 'free' number. That is your headroom.
- If available memory is less than 2 GB with nothing running, you need more RAM.
- Close unnecessary apps before continuing.
Step 2: Estimate the RAM cost of Docker Desktop
Docker Desktop itself uses RAM for the VM, the daemon, and any running containers. By default, Docker Desktop allocates up to 2 GB on macOS, but you can check and adjust this in Settings.
To see current Docker memory usage from the command line, use docker stats. This shows per-container usage, but the VM overhead is separate. On macOS, you can also check the process 'com.docker.backend' in Activity Monitor.
# Show running containers and their memory usage
docker stats --no-stream
# On macOS, check the Docker VM process
ps aux | grep com.docker.backend | grep -v grep- If you have no containers running, Docker Desktop still consumes 1-2 GB for the VM.
- Each container adds its own memory footprint. For example, a Node.js container might use 100-300 MB.
- You can limit Docker's memory in Docker Desktop settings (Settings > Resources > Memory).
Step 3: Estimate the RAM cost of VS Code
VS Code is an Electron app, so it uses more RAM than a native editor. Each extension and each open file adds to the total. A typical setup with a few extensions uses 1-2 GB.
To measure VS Code's actual memory usage, use your OS's process monitor or the command line.
# macOS / Linux
ps aux | grep -i "Code Helper" | awk '{sum += $6} END {print "VS Code total RSS (MB):", sum/1024}'
# Windows PowerShell
Get-Process | Where-Object {$_.ProcessName -like '*Code*'} | Measure-Object WorkingSet64 -Sum | ForEach-Object { "VS Code total RAM (MB): " + [math]::Round($_.Sum / 1MB, 1) }- If you have many extensions, consider disabling unused ones.
- The 'Remote - SSH' or 'Dev Containers' extensions add overhead when connected.
- For heavy projects, VS Code can use 3+ GB. Plan for at least 2 GB.
Step 4: Estimate the RAM cost of a local AI model
Local AI models are the biggest variable. The RAM required depends on the model's size and quantization. A 7B parameter model in 4-bit quantization uses roughly 4-5 GB of RAM. A 13B model uses 8-10 GB. A 70B model can use 40+ GB.
You can estimate the memory footprint of any model using this formula: memory in GB = (parameters in billions) * (bits per weight) / 8. For 4-bit, use 0.5 bytes per parameter; for 8-bit, use 1 byte per parameter.
Here is a quick Python script to calculate estimates for common models.
def estimate_memory(params_b, bits=4):
# params_b: billions of parameters
# bits: 4 or 8
bytes_per_param = bits / 8
return params_b * bytes_per_param
models = [
("Llama 3.2 3B", 3),
("Mistral 7B", 7),
("Llama 3.1 8B", 8),
("Llama 3.1 13B", 13),
("Mixtral 8x7B", 47),
]
for name, params in models:
for bits in [4, 8]:
mem = estimate_memory(params, bits)
print(f"{name} ({bits}-bit): {mem:.1f} GB")
print()- These estimates are for the model weights only. Inference also needs memory for context (KV cache), which grows with sequence length.
- Add 1-2 GB for the inference engine (llama.cpp, Ollama, etc.).
- Quantization reduces accuracy slightly but is often worth it for fitting in RAM.
Step 5: Add it all up with a real-world test
Now that you have estimates, test with a real workload. Start Docker, run a container, open VS Code, and load a local model. Then monitor total RAM usage.
I recommend using Ollama to run a local model because it is easy to install and manage. Here is how to pull and run a 7B model.
# Install Ollama (macOS/Linux)
curl -fsSL https://ollama.com/install.sh | sh
# Pull a 7B model
ollama pull llama3.2
# Run it in the background
ollama serve &
# Test with a prompt
ollama run llama3.2 "Explain the RAM requirements for Docker in one sentence."- While the model is running, check your system's memory usage again. Compare it to the baseline.
- The difference is the actual cost of your AI workload.
- If you see heavy swapping, you need more RAM or a smaller model.
Recommended setup: what I would use
Based on the measurements, here is a practical recommendation for a developer who wants to run Docker, VS Code, and a local 7B-8B model simultaneously without pain.
For a 7B model in 4-bit, you need about 5 GB for the model, 2 GB for Docker, 2 GB for VS Code, and 2 GB for the OS and other apps. That totals 11 GB. So 16 GB is the minimum I would recommend. If you want to run 13B models or multiple containers, go for 32 GB.
Here is a copy-paste configuration for Docker Desktop to limit memory and avoid overcommit.
{
"memoryMiB": 8192,
"cpus": 4,
"diskSizeMiB": 65536,
"swapMiB": 2048
}- Set Docker memory to 8 GB if you have 16 GB total; leave headroom for VS Code and the OS.
- Use 4-bit quantized models whenever possible to halve memory usage.
- Close unused containers and extensions to free RAM.
- Consider using WSL2 on Windows with a memory limit set in .wslconfig.
A quick .wslconfig for Windows users
If you are on Windows with WSL2, Docker Desktop uses WSL2 by default. You can limit WSL2 memory to keep the host responsive.
Create or edit the .wslconfig file in your user folder.
[wsl2]
memory=8GB
processors=4
swap=2GB
localhostForwarding=true- Run wsl --shutdown after changing .wslconfig to apply.
- This prevents WSL2 from eating all your RAM.
- Adjust the numbers based on your total RAM.
Troubleshooting: when you run out of RAM
If your system starts swapping, here is a quick checklist to regain control.
First, identify the biggest memory consumers using your OS tools, then take action.
- Stop Docker containers you are not using: docker stop $(docker ps -q)
- Close VS Code windows and extensions you don't need.
- Unload the AI model from memory (e.g., ollama stop llama3.2)
- Increase swap space temporarily: on Linux, sudo swapon --show; on macOS, let the system manage it.
- If the problem persists, reduce Docker memory allocation or switch to a smaller model.
FAQ
Here are answers to common questions about RAM and these workloads.
- Is 8 GB enough? Only if you run a very small model (1-3B) and avoid heavy containers. You will likely hit swap.
- Does GPU VRAM matter? Yes, if you have an NVIDIA GPU with enough VRAM, you can offload model layers, reducing system RAM usage.
- Can I use a model larger than my RAM? Not without swapping, which makes inference extremely slow. Stick to models that fit in RAM.
- Should I use Docker for AI models? It is convenient for packaging, but the container adds overhead. For local models, you might run the inference engine directly.
- How do I check real-time RAM usage? Use htop on Linux, Activity Monitor on macOS, or Task Manager on Windows.
Try it on code.live
If you want a quick way to generate a random string for testing or to estimate memory with a calculator, try the Random String Generator or the Unit Converter on code.live. These tools are handy for quick experiments without leaving your browser.
Key takeaways
- Apply one concrete change from this post before collecting more reading.
- Prefer browser-side tools when the work involves secrets, tokens, or PII.
- Document the why next to the how so the next reviewer inherits context.
FAQ
- Who is this guide on docker for?
- Working developers who need a practical take on how much ram do you need for docker + ai + vs code? — not a marketing overview. Skim the sections, apply one tip, then come back when you hit an edge case.
- Do I need an account to use the related tools?
- No. code.live tools run in your browser with no signup. Nothing you paste is uploaded to a server for the client-side utilities linked from this post.
- How often is this article updated?
- This post was published October 21, 2026. Fundamentals stay stable; check linked tool pages and official docs when version-specific behavior matters.