-
Notifications
You must be signed in to change notification settings - Fork 213
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
Support docker-compose build with a git
remote path as build.context
#367
Comments
Looking at https://containers.dev/implementors/json_schema/. It seems like the We'd use this issue to track this feature request. Thanks. |
git
remote path as build.context
Well, I'm not talking the `devcontainer.json`.
This happened when I config `dockerComposeFile` and point to local `docker-compose.yml` file that contains build context on remote path.
When I run`docker compose build` against the yml directly, it works.
When I run `devcontainer-cli build` against `devcontainer.json` file which referencing same yml file, it fails.
…--
***@***.***
0xD0AE6B4A6479A677
Jan 6, 2023 03:10:36 Samruddhi Khandale ***@***.***>:
Looking at https://containers.dev/implementors/json_schema/. It seems like the *Dev Containers Extension* does not support a *git* remote path yet.
We'd use this issue to track this feature request. Thanks.
—
Reply to this email directly, view it on GitHub[#367 (comment)], or unsubscribe[https://github.com/notifications/unsubscribe-auth/ACEFYQICCPRSXTQY32ISWY3WQ4MCZANCNFSM6AAAAAATRTLJBU].
You are receiving this because you authored the thread.[トラッキング画像][https://github.com/notifications/beacon/ACEFYQILLZXYYGBGITVVPRTWQ4MCZA5CNFSM6AAAAAATRTLJBWWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTSR2CJMG.gif]
|
Schema "context": {
"type": "string",
"description": "The location of the context folder for building the Docker image. The path is relative to the folder containing the `devcontainer.json` file."
} Looking at the error & the schema, devcontainers CLI is expecting a file path and not a git remote path in
It's expected as |
Thanks, I got your idea. I'll embed referenced context to workaround this.
BTW, can you point out the description of the remote build context limitation if any? I can't find it by search for `git` or `dockerComposeFile`.
Jan 6, 2023 07:23:35 Samruddhi Khandale ***@***.***>:
… Error: ENOENT: no such file or directory, open '/home/pingu/repo/vsnotes/.devcontainer/https:/my-private-repo/devcontainer.git/jdk.dockerfile'
{"outcome":"error","message":"ENOENT: no such file or directory, open '/home/pingu/repo/vsnotes/.devcontainer/https:/my-private-repo/devcontainer.git/jdk.dockerfile'","description":"An error occurred building the container."}
Looking at the error & the doc, devcontainers CLI is expecting a file path and not a git remote path in *docker-compose.yml*.
When I run *devcontainer-cli build* against *devcontainer.json* file which referencing same yml file, it fails.
It's expected as *devcontainer-cli* does not support it yet.
—
Reply to this email directly, view it on GitHub[#367 (comment)], or unsubscribe[https://github.com/notifications/unsubscribe-auth/ACEFYQIE3KPEBFQB3J262ALWQ5JXNANCNFSM6AAAAAATRTLJBU].
You are receiving this because you authored the thread.[トラッキング画像][https://github.com/notifications/beacon/ACEFYQNICJFP4HWU4W4AMHTWQ5JXNA5CNFSM6AAAAAATRTLJBWWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTSR2UO7S.gif]
|
@samruddhikhandale @joshspicer I would like to implement this feature for devcontainers. While going through the docker's codebase to understand how they are doing it, I realised they are cloning the repository in a temp directory and setting that as the context. https://github.com/docker/cli/blob/master/cli/command/image/build/context.go#L188-L193 Since, docker already clones the repository itself, I believe it could be implemented in one of the following ways:
Please let me know what you think about the two approaches. |
Thanks @ShauryaAg, we appreciate it!
Currently, this command fails as it is trying to validate that the Once that's done, it calls the I think the changes could be as simple as changing the inspect logic when @chrmarti looking for you thoughts here. Also, feel free to correct my understanding of how the build works. |
Cloning the context to a temp folder when the dockfile is a relative path and the context is a Git repository location sounds good. We should then also update the context to that temporary folder (using the override docker-compose.yml we add for building), so Docker doesn't run another clone. The relevant code starts here: cli/src/spec-node/dockerCompose.ts Line 164 in d1c0dac
|
Problem
Devcontainer-cli failed to build container with build context pointing to remote path (in this case, git).
sample docker-compose.yml:
This
docker-compose.yml
built correctly when usingdocker compose
but failed when usingdevcontainer-cli build
Version
devcontainer@0.27.1 /home/pingu/.nvm/versions/node/v14.21.2/lib/node_modules/@devcontainers/cli
Log file
The text was updated successfully, but these errors were encountered: