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

Test: Dev container image metadata #7248

Closed
3 tasks done
chrmarti opened this issue Sep 26, 2022 · 0 comments
Closed
3 tasks done

Test: Dev container image metadata #7248

chrmarti opened this issue Sep 26, 2022 · 0 comments

Comments

@chrmarti
Copy link
Contributor

chrmarti commented Sep 26, 2022

Refs: devcontainers/spec#95

Complexity: 4

Create Issue


  • Install the devcontainer CLI 0.16.0 or later: npm i -g @devcontainers/cli.
  • Have a base devcontainer.json in a base folder: base/.devcontainer.json
{
	"image": "ubuntu:latest",
	"postAttachCommand": "echo 'Hello from the postAttachCommand in the base image!'",
	"features": {
		"ghcr.io/devcontainers/features/terraform": "latest"
	},
	"customizations": {
		"vscode": {
			"extensions": ["chrmarti.regex"]
		}
	}
}
  • Have a workspace devcontainer.json in a workspace folder: workspace/.devcontainer.json
{
	"image": "test-base-image",
	"postAttachCommand": "echo 'Hello from the postAttachCommand in the workspace image!'",
	"customizations": {
		"vscode": {
			"extensions": ["ms-vscode.hexeditor"]
		}
	}
}
  • Build and tag the base image: devcontainer build --workspace-folder base --image-name test-base-image.
  • Verify the base devcontainer.json is recorded in the base image: docker inspect test-base-image | grep metadata
  • Start a workspace dev container: devcontainer up --workspace-folder workspace --remove-existing-container.
  • Verify that the two postAttachCommands are run.
  • Use VS Code with Dev Containers 0.254.0-pre-release or later to open the dev container.
  • Verify that VS Code installs the two extensions.

Check https://github.com/devcontainers/spec/blob/chrmarti/imagemetadata/proposals/image-metadata.md for the list of properties that are carried forward on images and how they are merged. Test a few more properties, including some of the additional properties on the devcontainer.json.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants