spec icon indicating copy to clipboard operation
spec copied to clipboard

postCreateCommand deletes git config

Open luftuq opened this issue 2 years ago • 6 comments

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

luftuq avatar Jul 16 '24 14:07 luftuq

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

samruddhikhandale avatar Jul 30 '24 16:07 samruddhikhandale

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.

gauravsaini04 avatar Oct 10 '24 08:10 gauravsaini04

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

gauravsaini04 avatar Nov 13 '24 10:11 gauravsaini04

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.

luftuq avatar Nov 13 '24 13:11 luftuq

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

v-Kaniska244 avatar Jan 07 '25 06:01 v-Kaniska244