-
Notifications
You must be signed in to change notification settings - Fork 305
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
postCreateCommand doesn't seem to run when using a named volume for ~/.vscode-server #1153
Comments
Could you append the output from the Dev Container terminal? Note that the |
@chrmarti Thanks for looking into this. Here's the output from the Dev Container terminal, on first remote open of the workspace after cleaning out all containers and images generated by VS Code. Full log
(You'll notice that it's using the build cache a lot when building the docker image; that's because I've found it saves me a lot of time to build and tag the image outside of VS Code when I change the Dockerfile, so I've basically done |
The output suggests that the container being started already has a |
Hum; good catch - that's probably because I've set up a local docker volume for the After running I realize this is a tall order, but is there a way to cache extensions between runs, but not cache |
Volume-mounting the extensions folder should work. Let us know if that works as expected. (@Chuxel We will need to update the hint in the documentation on this.) |
@chrmarti Volume mounting the extensions folder seems to make the postCreateCommand run properly, but now extensions are not installing. If I read the logs correctly, that's because the I guess it could be a permissions issue, too, if the volume mounted directory has incorrect permissions, but I don't see any error messages to that effect, and since it worked fine when volume-mounting Manually installing extensions through the UI works, and populates the directory. It's just the list of extensions in |
Extensions are installed only once, after that we don't want to update based on Currently the existence of the extensions folder is used as the only indication that extensions have been installed already. We could change that. |
For this scenario, it would be useful to have a similar marker file (maybe inside the extensions directory?) - that would make it easy to volume-mount the extensions directory, without breaking the detection scheme. |
@tomasaschan @chrmarti I don't think we want to recommend bind mounting extensions unless you are on the same OS the container is running. (So this would work for Linux users.) Some extensions do download secondary dependencies that are platform specific, so some may not work if they are volume mounted into the container. I know I've seen this in extensions like Live Share. If you're looking to have the extensions survive a rebuild, you can consider using a named volume instead. This is discussed here along with the note about postCreateCommand: https://code.visualstudio.com/docs/remote/containers-advanced#_avoiding-extension-reinstalls-on-container-rebuild We also now have a command you can run to install all local extensions in the container if this is what you are looking to do. |
@tomasaschan @chrmarti Oops!! Apologies - I misread this. You are doing a named volume - not a bind mount I assume? You can mount just the extensions folder to avoid this particular problem. So:
I can tweak the docs. You can then add the "bin" folder if you want to avoid downloading the server but still reset the data folder.
It would be a good thought to look at a different spot for the postCreateCommand marker so you could keep your data as well. |
@Chuxel @chrmarti Yeah, sorry for my confusing use of incorrect terminology here - I'm not using a bind mount, but a named volume, as you correctly inferred from my config sample. Mounting a named volume for the A command for bulk installing extensions would be useful, but I think it would make more sense then to install all extensions listed in Is the code for the startup sequence of a dev container open source? I tried looking through this repo for it, but didn't find anything, but if it's public I could take a stab at a PR to extend this functionality. |
If the marker file is in the No, this is not open source. |
I don't know, to be honest. Does installing an extension require more actions than putting stuff in that folder? If so, it would probably be better to have the marker file somewhere else. Since you were also talking about moving the |
Installing extensions only copies the extensions to that folder. I thought the question might be more whether or not you want your latest list of extensions applied each time you rebuild that container (as opposed to just once when the volume is new). |
Hm, that's a good point; if a colleague adds an extension to the config file, I want that to be installed when I open the workspace on my laptop. So I guess I think the marker file should not be in the volume :) |
@chrmarti @tomasaschan Yeah I played with this a bit - there's actually an extra step here too if you are using a non-root user right now. You need to pre-create the #421 is probably the right answer here - a 1st class feature. The directions are effectively a workaround for this gap, but getting the marker in place would help marker the workaround a bit better. I also agree that the markers should not be in the volume in these cases. I'll update docs and try to make the current behavior a bit more obvious in the near term - it's called out, but not well enough. |
Docs have been updated - I'm closing this in favor of 421, which is really the real fix here. |
Issue Type: Bug
Even though I've added a
postCreateCommand
entry to mydevcontainers.json
, the command does not seem to run at all.Steps to Reproduce:
cd root && ls -a
shows.ssh-localhost
, but not.ssh
🐛I see no error messages in the logs. I've tried triggering "Remote Development: Rebuild Container" as well as deleting both container and image before reloading the window, but get the same result anyway.
(For reference: this was cross-posted on stackoverflow.com, but hasn't attracted any attention there.)
Extension version: 0.67.3
VS Code version: Code 1.37.0 (036a6b1d3ac84e5ca96a17a44e63a87971f8fcc8, 2019-08-08T02:33:50.993Z)
OS version: Windows_NT x64 10.0.17763
Remote OS version: Linux x64 4.9.184-linuxkit
System Info
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_deferred_display_list: disabled_off
skia_renderer: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: disabled_off
webgl: enabled
webgl2: enabled
The text was updated successfully, but these errors were encountered: