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

Support for using unix pipes in devcontainer runArgs, in particular for --env-file #9446

Closed
jamesthurley opened this issue Jan 27, 2024 · 4 comments
Assignees
Labels
containers Issue in vscode-remote containers feature-request Request for new features or functionality

Comments

@jamesthurley
Copy link

jamesthurley commented Jan 27, 2024

Docker already supports using unix pipes to specify an environment variable file as follows:

docker run --env-file <(echo 'TEST_VARIABLE=TEST_VALUE') --rm ubuntu env

In my devcontainer.json I've tried doing the following:

  "runArgs": [
    "--env-file",
    "<(echo 'TEST_VARIABLE=TEST_VALUE')"
  ],

But I get the following error when the devcontainer starts:

docker: open <(echo 'TEST_VARIABLE=TEST_VALUE'): no such file or directory.

Specifically, I want to do this:

  "runArgs": [
    "--env-file",
    "<(op inject -i .env)"
  ],

This allows my devcontainer environment variables to be stored in 1Password and injected by the 1Password CLI.

My current workaround is the far less satisfactory:

  // Use the 1Password CLI to generate a .env.tmp file with secrets.
  "initializeCommand": "op inject --force --in-file .env --out-file .env.tmp",
 
  // Load the env file generated by the 1Password CLI.
  "runArgs": [
    "--env-file",
    ".env.tmp"
  ],

  // Clean up env file generated by the 1Password CLI.
  "postStartCommand": "rm .env.tmp",

Having to store secrets temporarily on disk is not great, and the postStartCommand isn't always run as I expected, leaving the secrets file sitting on disk after the devcontainer starts. Support for using unix pipes in runArgs would eliminate the need for the temp file and simplify the configuration.

@chrmarti
Copy link
Contributor

I think this is a shell feature and we run docker without shell.

@chrmarti chrmarti added the feature-request Request for new features or functionality label Dec 13, 2024
@vs-code-engineering vs-code-engineering bot added this to the Backlog Candidates milestone Dec 13, 2024
Copy link

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 10 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

Copy link

This feature request has not yet received the 10 community upvotes it takes to make to our backlog. 10 days to go. To learn more about how we handle feature requests, please see our documentation.

Happy Coding

Copy link

🙁 In the last 60 days, this feature request has received less than 10 community upvotes and we closed it. Still a big Thank You to you for taking the time to create this issue! To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

@vs-code-engineering vs-code-engineering bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
containers Issue in vscode-remote containers feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

3 participants