devcontainers / devcontainers/spec

Support post VScode install hook

Open
#414 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
5.7k
Forks
496
PR merge metrics
No merged PRs in 30d

Description

## Context

Hey all. I was working with devcontainers in the following setting:

Let's say I'm trying to get SSO to work with an external browser in a dev container. This is tricky because most SSO applications (and a lot of other ones for that matter) tend to use "Any free TCP port available". On linux, the OS will resolve this to a random available port. I found a work around to make this work by restricting available port range with something like `sysctl net.ipv4.ip_local_port_range: "60000 60100"` and just port forward those.

Now, I've noticed setting this on the docker build really hampers VScode devcontainers. Specifcally, the installation of extensions becomes very slow. There seems to be a lot of dynamic port use in the background when VScode is initially setting up a server and extensions on the dev container.

It's possible to resolve this (and other use cases I presume) by having some sort of a post-VScode build hook. Right now, all of the hooks given in the devcontainer.json cannot wait for the full VScode initialization to be complete before running code. The workaround now is doing something like adding entries to .bashrc or .zshrc to introduce custom pre-shell hooks whenever opening a new shell post build.

I'd think it makes sense to have support for a post VScode initialization hook within `devcontainer.json`, but not sure about the feasbility of something like that.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.