You can achieve this by adding .devcontainers/ to a global .gitignore file.
.devcontainers/
.gitignore
See this answer for more information on how to achieve this.
With this set up, all my dev containers are ignored until they are explicitly tracked in the repo.