Skip to content

Conversation

alza-bitz
Copy link
Contributor

To persist the value into running containers.

Fixes #29.

To persist the value into running containers.

Fixes scicloj#29.
@behrica
Copy link
Member

behrica commented Mar 7, 2025

I still now too little about this.
When we use ARG, we loose the capability to have it overwritten with the host variable, correct ?

alza-bitz added a commit to alza-bitz/playpen-clojure that referenced this pull request May 15, 2025
alza-bitz added a commit to alza-bitz/alza-bitz.github.io that referenced this pull request May 27, 2025
@alza-bitz
Copy link
Contributor Author

I still now too little about this. When we use ARG, we loose the capability to have it overwritten with the host variable, correct ?

Hi @behrica apologies for the delayed reply.

I don't know what you mean by "host variable"? Is there any use case or scenario where the username in the container needs to be something other than "vscode"?

Regarding ARG vs ENV, this article explains the difference:

https://www.docker.com/blog/docker-best-practices-using-arg-and-env-in-your-dockerfiles/

ARG: "The ARG instruction allows you to define variables that will be accessible during the build stage but not available after the image is built."

ENV: "Unlike ARG, the ENV command allows you to define a variable that can be accessed both at build time and run time."

This would imply that changing from ARG to ENV will not break anything, since ENV is available in both contexts.

It also implies that USERNAME is needed at run time when the container starts. However, without further investigation I can't explain why (build-time only) ARG is sufficient for the "new dev container" case but not sufficient for the "clone repository in container volume" case.

Suggestion: if ENV is observed to work for USERNAME in both cases anyway, that is a sufficient test result, and so this PR could be merged?

Btw, some context:

  1. I raised this issue because I am hitting it every time I use "clone repository in container volume". Each time, I have to manually edit the Dockerfile in a recovery container, then rebuild again.

  2. AFAIK this template is the only Clojure template available inside the VSCode menus (thanks to your efforts!) but as such, if it doesn't work then there's no alternative available (other than manually fixing the issue each time, or rolling your own template).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when cloning repo in container volume using basecloj template
2 participants