-
Notifications
You must be signed in to change notification settings - Fork 28
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
initializeCommand not executed in envbuilder #395
Comments
This looks like a functionality gap in Envbuilder. It currently supports the following lifecycle script hooks:
We're currently missing support for:
ref: https://containers.dev/implementors/json_reference/#lifecycle-scripts |
@creeram could you expand on what you're expecting to happen? To me it sounds like @johnstcn I think finding a good fit for |
@mafredri I expect the script to be executed before the Docker build starts, That feature is already available in vs code dev container but not in Envbuilder. |
@creeram would you mind sharing what Right now I don't think it will behave as you expect, if I'm understanding you correctly that is. Let me explain. As an example let's say
Then we run envbuilder like this:
What will happen is that Envbuilder will:
At step 3 we run into an error because neither |
@mafredri The envbuilder clones the repository the first time it runs, and on subsequent restarts, it skips the clone because the repo is already cloned in the persistent volume. Let’s assume I changed the Dockerfile in the remote repo and want to pull the updated content before the Docker build starts. However, ENVBUILDER_INIT_COMMAND=/bin/bash is currently executed after the Docker build. I want repoupdate.sh to run before the Docker build begins, so it pulls the latest changes in the Dockerfile and uses the updated version for the build. The steps you mentioned:
Envbuilder skips the Try to run initializeCommand .devcontainer/update.sh part. but when I try the same devcontainer.json file in vscode devcontainer the initializeCommand works as expected. |
This tracks with what I thought you were looking for, thanks for clarifying.
Yes, that's what envbuilder does now. My example above was a hypothetical of what will happen if we support It works in VS Code because there are two explicit environments, the host machine (runs If envbuilder did support Although I'm focusing on the problems here, it's not because we don't want to support Side note: One way to achieve what you're looking for today is to use the We're also looking into implementing an option that will allow you to pull changes even if the repo is already cloned (e.g. #281). That's another way that the behavior you're looking for can be reproduced in envbuilder. Unfortunately, neither is the same as |
@mafredri Rather than pulling all changes in the repository, the goal is to pull only changes from the .devcontainer folder. This is what I'm trying to achieve using the update.sh script as follows:
|
I have the below configuration on the devcontainer.json file and I want to run some scripts before dockerbuild starts but the "initializeCommand" is not executed when the container is started.
There are not logs for this as well i can only see logs starting from building image
The text was updated successfully, but these errors were encountered: