Answer the question
In order to leave comments, you need to log in
How to correctly throw ssh agent into a docker container?
I'm trying to throw the ssh agent into the docker image, the cat is part of the CI / CD pipeline.
I run it in the pipeline, in Linux
echo "ssh-path=$SSH_AUTH_SOCK"
everything works ... returns the path
ssh-path=/opt/buildagent/temp/buildTmp/ssh618017239674568317sock
then I transfer it to the Docker image (my build from alpine) - below lines from Dockerfile
FROM alpine:latest
RUN apk -v add --update --no-cache bash openssh-client
RUN eval $(ssh-agent)
Answer the question
In order to leave comments, you need to log in
hello everyone, I was tormented for 2 days, but I did it - I had to throw two volumes including /.ssh with read-only
Works when it starts as a root user, I did not test it on others
export SSH_AUTH_SOCK_DIR=$(dirname $SSH_AUTH_SOCK)
export SSH_DIR=/root/.ssh/
docker run -v $SSH_DIR:$SSH_DIR:ro -v $SSH_AUTH_SOCK_DIR:$SSH_AUTH_SOCK_DIR --env SSH_AUTH_SOCK=$SSH_AUTH_SOCK
--pull image:version
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question