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

Pass runArgs from devcontainer.json into docker run command #337

Merged
merged 1 commit into from
May 24, 2023

Conversation

vegasje
Copy link
Contributor

@vegasje vegasje commented May 22, 2023

runArgs set in devcontainer.json are currently parsed by DevPod, but they are not added when the docker run command is issued.

This change passes runArgs into the docker run command.


I found the need for runArgs as I was attempting to set up multiple containers that could communicate with each other. Docker Compose is often used for this scenario, but I needed to work with Docker networking directly.

Being able to pass the runArgs to the docker run command allowed me to achieve this:

{
	"name": "devpod-test",
	"build": {
		"dockerfile": "Dockerfile"
	},
	"initializeCommand": "docker network inspect test-network >/dev/null 2>&1 || docker network create --driver bridge test-network",
	"runArgs": [
		"--name=devpod-test",
		"--network=test-network"
	],
	...
}

@kloudsamurai
Copy link

+1

we will utilize this PR once adopted as well.

adds support for Image or Dockerfile-specific properties of devcontainer.json, which seems to align with the project goal of supporting:
https://containers.dev/implementors/json_reference/#image-specific

Copy link
Member

@FabianKramm FabianKramm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vegasje thanks for the PR! LGTM!

@FabianKramm FabianKramm merged commit f3a4ccd into loft-sh:main May 24, 2023
@vegasje vegasje deleted the add-runargs branch May 25, 2023 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants