devcontainers / spec

Development Containers: Use a container as a full-featured development environment.
https://containers.dev
Creative Commons Attribution 4.0 International
3.34k stars 205 forks source link

postCreateCommand deletes git config #476

Open luftuq opened 1 month ago

luftuq commented 1 month ago

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 commented 1 month ago

ramanlay20@gmail.com

samruddhikhandale commented 1 month ago

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