-
Notifications
You must be signed in to change notification settings - Fork 259
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
Environment and pre-defined variables are not supported in forwardPorts
and keys of portsAttributes
#489
Comments
Does |
Hi @chrmarti! Thank you for looking into this. I am not sure what "work" means if we are talking about the spec here. Do you have a specific implementation in mind? https://containers.dev/implementors/json_reference/ seems to talk about pre-defined variables as a whole. Either
...or nothing at all. So my expectation is that if |
|
Sorry, I didn't mention it. Since |
Please help me with this issue and report back on things that are not
working properly in my dev containers for the account I have been using for
the last two months I need to get a new one I don’t know what to do with
this issue but please advise
Brecht Vrolix
…On Tue, 17 Sep 2024 at 11:20, i-ky ***@***.***> wrote:
I don't see from your report if you set POSTGRES_HOSTNAME in the
container. I do see that you are using the local env variable
POSTGRES_HOSTNAME in the docker-compose.yml, so localEnv: might work,
depending on where you set POSTGRES_HOSTNAME locally.
Sorry, I didn't mention it. POSTGRES_HOSTNAME is set in .env file (from
there POSTGRES_HOSTNAME gets into Compose file) and .env file is also
passed to the dev container in Compose file as env_file: (this is how
POSTGRES_HOSTNAME gets into container environment).
Since POSTGRES_HOSTNAME is not set in host environment, I think that
localEnv: will not work. Do you want me to try?
—
Reply to this email directly, view it on GitHub
<#489 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AS6S7WNXVZ4JHNQUURD6FU3ZW7X5NAVCNFSM6AAAAABMQRHLYCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJUHE4TSMJQGI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
You're right. Support for env files has come up before. Related: microsoft/vscode-remote-release#3007 |
Are you implying that if |
To avoid hardcoding hostnames I am using environment variables, e.g.
${POSTGRES_HOSTNAME}
. This allows pointing application or any supplementary scripts to the correct host depending on the environment (e.g. in and out of dev container).Same variables are used as
hostname:
in Docker Compose files:And same variables should be used in
forwardPorts
andportsAttributes
of dev container configuration:Unfortunately,
forwardPorts
andportsAttributes
don't support variables, so it needs to be hardcoded instead:...meaning that hostname needs to be changed manually in two more places if the environment variable changes.
The text was updated successfully, but these errors were encountered: