Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port features.json properties for most common runtime arguments #2

Open
Chuxel opened this issue Jan 21, 2022 · 5 comments
Open

Port features.json properties for most common runtime arguments #2

Chuxel opened this issue Jan 21, 2022 · 5 comments
Labels
proposal Still under discussion, collecting feedback

Comments

@Chuxel
Copy link
Member

Chuxel commented Jan 21, 2022

As a part of development for dev container features (#60), we introduced properties for the most common runtime arguments used in devcontainer.json's runArgs property. The great part about this implementation is that it worked with Docker Compose as well and is abstracted enough to work with other potential orchestrators or container runtimes down the road. It would be awesome to bring these to devcontainer.json as well.

Specifically:

We could also bring containerEnv into Docker Compose as it is in features.json.

Ideally we'd continue this trend whenever a new property along these lines is added to features.json (and vice versa).

@Chuxel Chuxel added the proposal Still under discussion, collecting feedback label Jan 21, 2022
@Chuxel Chuxel changed the title Properties for most common runtime arguments Port features.json properties for most common runtime arguments Jan 21, 2022
@joshspicer
Copy link
Member

I like this - will clean up our templates a bit and improve readability.

@Chuxel
Copy link
Member Author

Chuxel commented Jan 26, 2022

Yep! It should future proof the spec as well given interest in different container engines. These can have orchestrators that have subtle tweaks in how these need are set. We don't want to "be the orchestrator", but provide a place to house subset of properties that are specific to dev that need to happen regardless of them - e.g. capAdd to enable ptrace based debuggers.

@numeralz
Copy link

Is is possible to specify overrides for a feature added to devcontainer.json? It may solve a class of issues where the default arguments (like mounts) of feature definitions need to be removed/changed.

For example, I added the docker-in-docker feature to my devcontainer.json, but in order to be able to have docker-in-docker enabled in more than one containers on one host, you must mount /var/lib/docker to a uniquely-named volume.

	"features": {
		"docker-in-docker": {
			"version": "latest",
			"moby": true,
			"dockerDashComposeVersion": "v1"
			//FIXME: can we have "customizations": { "mounts": [  ] } or similar
		},
        },
        // attempt to mount /var/lib/docker to unique :
	"mounts": [
		"source=UNIQUE-dind-var-lib-docker,target=/var/lib/docker,type=volume"
	]

Fails because "docker-in-docker" feature def has a built-in mount to /var/lib/docker which conflicts with my uniquely-named volume:
from error log, formatted for readability:

...
--mount source=UNIQUE-dind-var-lib-docker,target=/var/lib/docker,type=volume   <-- my attempt
--mount type=volume,src=dind-var-lib-docker,dst=/var/lib/docker    <-- built-in
--mount type=volume,src=vscode,dst=/vscode -l
...
echo Container started
docker: Error response from daemon: Duplicate mount point: /var/lib/docker. <-- conflict
...

The drop-in features are great until they don't work for rare edge cases. I suppose this issue could be resolved by adding an additional config parameter to disable/rename /var/lib/docker mount, but something like "features.*.customizations" could reduce the overall need to design features with every possible use-case in mind.

microsoft/vscode-dev-containers#1249

https://github.com/microsoft/vscode-dev-containers/blob/72359e9ca313b7ab529a9481aae84432a81e007f/script-library/container-features/src/devcontainer-features.json#L36

microsoft/vscode-remote-release#5679


FYI: If anyone has this issue, the workaround is to use manual script method docker-in-docker.md#script-use and remove the "docker-in-docker" feature from devcontainer.json.

@Chuxel
Copy link
Member Author

Chuxel commented Jul 15, 2022

@numeralz Thanks for the reminder on this one - I raised #62 for the proposed solution to handle this one.

@chrmarti
Copy link
Contributor

We added mounts, containerEnv, containerUser, init, privileged, capAdd, and securityOpt as part of #95.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal Still under discussion, collecting feedback
Projects
None yet
Development

No branches or pull requests

4 participants