microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.61k stars 274 forks source link

Customize/override bootstrap.Dockerfile #8102

Open PvanHengel opened 1 year ago

PvanHengel commented 1 year ago

As an enterprise developer that uses devcontainers, I need to add custom root certificates using a script file in the bootstrap docker file used to bootstrap (git clone) source code into the true dev container. Without these root certificates in the docker image installed via a custom script there is no way to clone the repo.

One can modify the bootstrap.Dockerfile in the users .vscode folder, which gets copied into the /var/... location before building, helper scripts placed there are not available to be added to the base image. A more robust system for making modifications to the root image, or a system setting to override the bootstrap image used (that ideally persists as versions of the extension are upgraded as well) is required.

PvanHengel commented 1 year ago

Any update when this might be able to be looked at, its a blocker at this point and really are unable to make any progress due to the root certificates not being inside the bootstrapping image used to clone and create the volume. Ive been hacking around and cannot reliably create any solution that would work across multiple developer machines.

pootow commented 1 year ago

3809 can also use this feature, what we really want is to run devcontainer in a network restricted area, so we can inject proxies, mirrors and such other envs etc into the Dockerfile.

francoissharpe commented 6 months ago

Even simply being able to specify the base image used by the clone and recovery container in the settings, would at least allow us to push the preconfigured image to our internal registry and have it work.

chrmarti commented 6 months ago

@PvanHengel The latest pre-releases (currently Dev Containers 0.344.0-pre-release) loads the system certificates into the bootstrap container. Could you give that a try? (Tracked as https://github.com/microsoft/vscode-remote-release/issues/6092.)

kimidaisuki22 commented 6 months ago

I know this is bad, but the customize can be done by replacing the file content under ~/.vscode/extensions/ms-vscode-remote.remote-containers-{version}/scripts/bootstrap.Dockerfile

chrmarti commented 6 months ago

What are the other use-cases for overriding this Dockerfile aside from loading root certificates? Ideally everything would just work out-of-the-box, so I'd be interested if we can improve on that before we make the Dockerfile configurable.

kimidaisuki22 commented 6 months ago

What are the other use-cases for overriding this Dockerfile aside from loading root certificates? Ideally everything would just work out-of-the-box, so I'd be interested if we can improve on that before we make the Dockerfile configurable.

It may not a problem about Dockerfile configurable: clone repo into volume is handy, but volume-bootstrap is slow to build in my network, for me I just prebuild it in the background and then fetch it from LAN when I use it.

I have tried to simply replace the build file, but it has a more complex image than I think, so I just give up. And I think the customize just adds more cost for both users and the dev team and not enough benefit.

Maybe an addition Dockerfile can be added to build final image onto current boostrap image, it is easier to maintain and add some customization for end users.

PvanHengel commented 5 months ago

use-cases for overriding this Dockerfile aside from loading root certificates? Ideally everything would just work out-of-the-box, so I'd be interested if we can improve on that before we ma

What are the other use-cases for overriding this Dockerfile aside from loading root certificates? Ideally everything would just work out-of-the-box, so I'd be interested if we can improve on that before we make the Dockerfile configurable.

Another use case might be setting up the openssl.conf file, hosts file, or other OS level settings that are required during the bootstrapping process.

wanxger commented 4 months ago

I know this is bad, but the customize can be done by replacing the file content under ~/.vscode/extensions/ms-vscode-remote.remote-containers-{version}/scripts/bootstrap.Dockerfile

I hope to be able to modify the bootstrap.Dockerfile. Due to network issues, I am unable to open the dev container smoothly. If it is not possible to overwrite the bootstrap.Dockerfile, can a custom shell be executed instead? Just the manual replacement method in the above method needs to be implemented through the shell.

wanxger commented 4 months ago

I know this is bad, but the customize can be done by replacing the file content under ~/.vscode/extensions/ms-vscode-remote.remote-containers-{version}/scripts/bootstrap.Dockerfile

I hope to be able to modify the bootstrap.Dockerfile. Due to network issues, I am unable to open the dev container smoothly. If it is not possible to overwrite the bootstrap.Dockerfile, can a custom shell be executed instead? Just the manual replacement method in the above method needs to be implemented through the shell.

I used a script locally to perform automatic replacements. It works, but it cannot be written once and run everywhere.

h4de5 commented 1 month ago

when cloning our repository (which has git-lfs and post-checkout) we always got the message to set GIT_CLONE_PROTECTION_ACTIVE=false to overcome the cloning. the only way we found for now, was to adapt this file locally on each machine

chrmarti commented 1 month ago

@h4de5 I will update the base image to mcr.microsoft.com/devcontainers/base:0-alpine-3.20 to pick up Git 2.45.2 which has a fix for your issue: https://github.com/git-lfs/git-lfs/issues/5749#issuecomment-2145600523

chrmarti commented 1 month ago

This fix is available in Dev Containers 0.381.0-pre-release.