No pain, no gain — Install dependencies
$ docker run --rm -it -v ~/.ssh:/root/.ssh:ro alpine:latest
/ # apk add --no-cache -U openssh-client
/ # ssh
[email protected]
PTY allocation request failed on channel 0
Hi creasty! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.
FROM alpine:latest
RUN apk add --no-cache -U openssh-client git
RUN git config --global --add '
[email protected]:.insteadof' https://github.com/
RUN git config --global --add '
[email protected]:.insteadof' git://github.com/
Mount the host’s ~/
.ssh directly to a container’s /root/
.ssh with readonly mode
Force git to use SSH for git and https protocols.