git install fails in Dockerfile git install fails in Dockerfile docker docker

git install fails in Dockerfile


You are overanalyzing this. It's just a simple typo. Should be:

RUN apt-get update && \    apt-get upgrade -y && \    apt-get install -y git

Those are 3 separate commands.


Some thoughts:

    1. Replace apt-get install git with apt-get install --assume-yes git. Without the --assume-yes it will prompt you for confirmation, which you are unable to give and it will be smart enough to figure that out and assume you meant "NO".
    1. You added the ssh key, but did you confirm it was 0600. I would just copy it and specifically chmod 0600 ~/.ssh/id_rsa to be sure.

Overall, your Dockerfile looks very clever and I got some fresh ideas from reading it.


For those working with alpine images, RUN apk add --no-cache git did the trick for me.