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

postCreateCommand deletes git config #476

Open
luftuq opened this issue Jul 16, 2024 · 6 comments
Open

postCreateCommand deletes git config #476

luftuq opened this issue Jul 16, 2024 · 6 comments

Comments

@luftuq
Copy link

luftuq commented Jul 16, 2024

Hi all,
I see inconsistent result when I run
"postCreateCommand": "git config --global user.signingkey /home/mambauser/.ssh/id_ed25519.pub"
to redirect my keys to docker folder. All other global configurations (which are moved to docker automatically) are not in container. This does not happen if I change it to postStartCommand. I would expect that result would be the same. Simplified devcontainer.json where it happens is here:

  {
    "name": "name",
    "build":{
        "dockerfile": "Dockerfile",
        "context": "../",
        "args": { "HTTP_PROXY": "${localEnv:HTTP_PROXY}",
                  "HTTPS_PROXY": "${localEnv:HTTPS_PROXY}" 
                }
    },
    "containerEnv": { "HTTP_PROXY": "${localEnv:HTTP_PROXY}",
                   "HTTPS_PROXY": "${localEnv:HTTPS_PROXY}" 
    },
  "mounts": [
    "source=${localEnv:USERPROFILE}/.ssh,target=/home/mambauser/.ssh,type=bind,consistency=cached"
    ],
    "postCreateCommand": "git config --global user.signingkey /home/mambauser/.ssh/id_ed25519.pub"
}

and the dockerfile:

    FROM mambaorg/micromamba
    ARG MAMBA_DOCKERFILE_ACTIVATE=1 
    RUN micromamba config append channels conda-forge
    # Install Git
    USER root
    RUN apt-get update && apt-get install -y git
    USER $MAMBA_USER
@0943916975
Copy link

[email protected]

@samruddhikhandale
Copy link
Member

@gauravsaini04 / @prathameshzarkar9 Can either of you help investigate the issue? thanks!

@gauravsaini04
Copy link

Hi @luftuq,
Thank you for reporting this issue. To help us understand and resolve it more efficiently, could you please provide a minimal reproduction example? This will allow us to replicate the problem on our end and investigate it further.

@Xcopz1 Xcopz1 mentioned this issue Oct 10, 2024
@gauravsaini04
Copy link

Hi @luftuq

Thank you for raising this issue and for your patience

As there hasn't been any recent activity on this issue, we're going to close it for now

If you have any further updates or if the issue still persists, please feel free to reopen it or create a new issue

@luftuq
Copy link
Author

luftuq commented Nov 13, 2024

Hi @gauravsaini04,
I am sorry it took me a while. Here is really minimal reproduction I can do.
devcontainer.json:

{
"name": "name",
"build":{
    "dockerfile": "Dockerfile",
    "context": "../"
    //"args": { "HTTP_PROXY": "${localEnv:HTTP_PROXY}",
    //          "HTTPS_PROXY": "${localEnv:HTTPS_PROXY}" 
    //        }
},
"postCreateCommand": "git config --global user.name test"
}

Dockerfile:

FROM mambaorg/micromamba
USER root
RUN apt-get update && apt-get install -y git
USER $MAMBA_USER

The issue is, that if I switch postCreateCommand for postStartCommand, I will get different results after rebuild.

@Kaniska244
Copy link

Hello @luftuq ,

Thank you for your patience and for providing simpler steps to reproduce the issue. I have one final request in this regard. You have mentioned in the issue description that certain global configurations which had moved automatically to the docker container were retained while using the postStartCommand tag.
Would you kindly point them out for my better understanding of the issue?

With Regards,
Kaniska

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

No branches or pull requests

5 participants