How to Set a Custom Docker Container Name in a Dev Container
How to Set a Custom Docker Container Name in a Dev Container If you've ever used Dev Containers in VS Code, you've probably noticed that your container ends up with a random generated name like upb...

Source: DEV Community
How to Set a Custom Docker Container Name in a Dev Container If you've ever used Dev Containers in VS Code, you've probably noticed that your container ends up with a random generated name like upbeat_heyrovsky or zealous_bookworm — even after setting the "name" field in your devcontainer.json. That's because "name" is just the display name in VS Code. It has nothing to do with the actual Docker container name. Before — random generated name: The Problem When your devcontainer.json uses a single image (no Docker Compose), there's no obvious way to control the container name: { "name": "my_project", // ← this is just a VS Code label "image": "mcr.microsoft.com/devcontainers/typescript-node:3-24" } VS Code will still spin up a container with a random Docker name. Tools like OrbStack or Docker Desktop will show something completely unrelated to your project. The Fix Use runArgs to pass Docker run arguments directly: { "name": "my_project", "image": "mcr.microsoft.com/devcontainers/typescr