I have been working on a file transfer feature. Our application is deployed with a Docker image on a hosting service called Aptible. The file transfer is currently implemented with SFTP and public key authentication.
I am having a problem with Docker Containers generated based on the image because the containers do not start
ssh-agent automatically on Container launches.
ssh-agent is required for the authentication. I am trying to setup some scheduled job to generate and send files through SFTP so I would need
ssh-agent to always run inside these Docker Containers.
I have these in my Dockerfile but it does not seem to start
ssh-agent inside the containers
RUN mkdir -p /root/.ssh RUN set -a && . /app/.aptible.env && echo "$PRIVATE_KEY" > /root/.ssh/id_rsa RUN set -a && . /app/.aptible.env && echo "$PUBLIC_KEY" > /root/.ssh/id_rsa.pub RUN chmod 600 /root/.ssh/id_rsa RUN eval "$(ssh-agent -s)"
Source: Docker Questions