-
Notifications
You must be signed in to change notification settings - Fork 275
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
Remote container is not picking up set environment variables #4585
Comments
Sorry, I forgot to provide an update on this. I am adding this just in case someone else faces this. The main idea here was to create a wrapper on laravel sail to create a deployable dev environment for Laravel 8. The above approach wasn't adding the environment variables to the container so ended up sharing the top level Laravel's This is what I had to do to make it happen. Add init file
|
Not sure what we would ideally do to improve this, but there are several feature requests in this area. Closing as resolved question. Thanks. |
Hi @chrmarti I understand the resolution but I would suggest using the above information to reproduce it. The main purpose is to get the env in the container but the support is really not there if the container starts from docker-compose. I tried every configuration for environment in dev container and none worked. Even passing a different env file via env_file command didn't work when I initialized the container using vscode. I really wanted to avoid polluting the .env since it was used by laravel and I was more or less forced to use this option after a lot of trial and error. It was my last resort. |
You're right: |
It appears that My workaround is to add the following to the devcontainer.json: There is a number of tickets dealing with this issue (e.g. #3061 #2323). Having the option to provide |
@k8n That sounds like a different problem. Could you open a new issue with steps to reproduce? Appending the config files if possible. |
Tracking as #4885. |
I am getting this problem with Laravel. I am trying to set up
WWWGROUP
andWWWUSER
variables to dynamically fetch and persist in the env and theDockerfile
is unable to get them when passed viadevcontainer.json
throughdocker-compose.yml
toDockerfile
.I have tried everything
containerEnv
,remoteEnv
,build.args
but none pass the environment values down.This is how my current setup looks like.
docker-compose.yml
Dockerfile
devcontainer.json
The text was updated successfully, but these errors were encountered: