user6107987
user6107987

Reputation:

How to add ssh key to docker container?

I have existing Rails application with Capistrano for deployment. Now my team switched this project to Docker. When I'm trying

docker-compose run web cap production git:check

I have git exit status: 128. I know it's a problem with ssh from Docker.

Can I add SSH key into Docker container and run cap production deploy?

Upvotes: 1

Views: 3744

Answers (1)

Stanislav Mekhonoshin
Stanislav Mekhonoshin

Reputation: 4386

I believe you can use volumes, to mount your ssh key inside container: https://docs.docker.com/compose/compose-file/#volume-configuration-reference

like:

volumes: - ~/.ssh/id_rsa:/home/user/.ssh/id_rsa

Upvotes: 3

Related Questions