Open victorfrancax1 opened 2 weeks ago
@victorfrancax1 thanks for reporting the issue and summary of the problem! Does this also occur using an absolute path? I believe inside the container the working directory will be /workspaces/{id}
whereas during the docker run it would not be
hey @bkneis! just tried that, but no luck so far. I can see that the file is present in that location inside the container, but docker still can't find it.
15:00:09 info Inspecting image mcr.microsoft.com/devcontainers/go:0-1.20-bullseye
15:00:09 debug Running docker command: docker run --sig-proxy=false --mount type=bind,src=/Users/victor/projects/external/devpod-example-go,dst=/workspaces/devpod-example-go,consistency='consistent' -u root -e DEVPOD=true -e REMOTE_CONTAINERS=true -e DEVPOD_WORKSPACE_ID=devpod-example-go -e DEVPOD_WORKSPACE_UID=devpod-exa-4d4ad --init --cap-add SYS_PTRACE --security-opt seccomp=unconfined -l dev.containers.id=devpod-exa-4d4ad -l devcontainer.metadata=[{"id":"ghcr.io/devcontainers/features/common-utils:2"},{"id":"ghcr.io/devcontainers/features/git:1"},{"id":"ghcr.io/devcontainers/features/go:1","customizations":{"vscode":{"extensions":["golang.Go"]}},"init":true,"capAdd":["SYS_PTRACE"],"securityOpt":["seccomp=unconfined"]},{"id":"ghcr.io/devcontainers/features/node:1","customizations":{"vscode":{"extensions":["dbaeumer.vscode-eslint"]}}},{"remoteUser":"vscode","customizations":{"vscode":{"extensions":["golang.Go"],"settings":{"go.gopath":"/go","go.toolsManagement.checkForUpdates":"local","go.useLanguageServer":true}}}},{"forwardPorts":["4000"],"customizations":{"devpod":{"prebuildRepository":"ghcr.io/loft-sh/devpod-example-go"}}}] -l devpod.user=root --env-file=/workspaces/devpod-example-go/.devcontainer/devcontainer.env -d --entrypoint /bin/sh mcr.microsoft.com/devcontainers/go:0-1.20-bullseye -c echo Container started
trap "exit 0" 15
exec "$@"
while sleep 1 & wait $!; do :; done -
15:00:09 info docker: open /workspaces/devpod-example-go/.devcontainer/devcontainer.env: no such file or directory.
15:00:09 info See 'docker run --help'.
15:00:09 info exit status 125
Not sure if you meant the absolute path of the file on the host, so I also tried that. Same error.
while sleep 1 & wait $!; do :; done -
15:06:11 info docker: open /Users/victorf/projects/devpod-example-go/external/.devcontainer/devcontainer.env: no such file or directory.
15:06:11 info See 'docker run --help'.
@victorfrancax1 I've just realised you are using an image
in your devcontainer.json instead of a build. This will use the image you specified as the container, therefore not containing your .env file. In order to accomplish what you want I believe you need to add a mount
https://containers.dev/implementors/json_reference/ to mount the .env file to a known location then source this in runArgs
. Let me know if this helps!
What happened? I've been trying to use a file to pass env vars into the containers via
runArgs
in.devcontainer/devcontainer.json
, but when devpod executeddocker run
, it can't find the file.What did you expect to happen instead?
I expected the file to be loaded properly. It works without issues if I run it on VS Code.
How can we reproduce the bug? (as minimally and precisely as possible)
I've cloned https://github.com/loft-sh/devpod-example-go and made the following tweak to
devcontainer.json
:I've also made sure that
.devcontainer/devcontainer.env
was present and had the correct permissions.Then I ran
devpod up . --ide none --debug
Local Environment:
DevPod Provider:
docker (colima)