Skip to content
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

ENV variable substitution no longer working in Dockerfiles? #7358

Closed
ocoleman-cordel opened this issue Oct 13, 2022 · 3 comments
Closed

ENV variable substitution no longer working in Dockerfiles? #7358

ocoleman-cordel opened this issue Oct 13, 2022 · 3 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug containers Issue in vscode-remote containers verified Verification succeeded
Milestone

Comments

@ocoleman-cordel
Copy link

VS Code version: 1.72.0
Dev Containers version: 0.255.3
Host operating system: Ubuntu 22.04
Docker version: 20.10.18

We have a base docker image that specifies an ENV variable for a user name. We build that docker image outside of vscode.
We then have a separate "dev" dockerfile that builds on this image that we open with the Dev Container extension. This "dev" dockerfile needs to use the ENV variable from the base image.

This has been working for us for a year or two now. A couple of days ago it stopped working, build/launch log attached.

If we replace the ENV variable with a hard-coded value in the "dev" dockerfile it works again. Perhaps ENV variable substitution is broken?

NOTE: once this error has occurred we have to remove the built images and containers from docker cache before a new working image can be built (eg with docker system prune). Probably not everything, but we wanted to be sure.

I made a minimal reproducible example, attached.

Steps to reproduce:

  1. Extract the zip file into a new folder.
  2. Build the base image with: docker build -t testbaseimage -f Dockerfile.base .
  3. Open the new folder in vscode.
  4. Run the Reopen in container command: it builds and opens without issue.
  5. In .devcontainer/Dockerfile (the "dev" dockerfile referred to above):
    • uncomment the line # USER $MYUSER , and
    • comment out the line USER testuser
  6. Run the Reopen in container command: it fails.

remoteContainers-2022-10-13T00-20-23.815Z.log
test.zip

@Chuxel Chuxel transferred this issue from microsoft/vscode-dev-containers Oct 13, 2022
@Chuxel Chuxel added the containers Issue in vscode-remote containers label Oct 13, 2022
@chrmarti chrmarti self-assigned this Oct 25, 2022
@chrmarti chrmarti added the bug Issue identified by VS Code Team member as probable bug label Oct 25, 2022
@chrmarti chrmarti added this to the October 2022 milestone Oct 25, 2022
@chrmarti
Copy link
Contributor

Related: #7303

chrmarti added a commit to devcontainers/cli that referenced this issue Oct 27, 2022
chrmarti added a commit to devcontainers/cli that referenced this issue Oct 27, 2022
@rzhao271 rzhao271 added the verified Verification succeeded label Oct 27, 2022
@chrmarti
Copy link
Contributor

This should be fixed in Dev Containers 0.262.0-pre-release. Could you give that a try and let me know if it indeed fixes this issue? Thanks!

@rzhao271
Copy link

It works on 0.262.0. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug containers Issue in vscode-remote containers verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants