2

I have a Dockerfile that extends Atmoz/sftp. It is stored in a git repo. The purpose of the image is to be loaded from docker-compose and serve as the test version of a business partners SFTP server that the main application in the git repo can connect to and perform sftp operations.

I want to persist the ssh server keys in the repo that lives in /etc/ssh. Like the readme recommends. I do the following in docker-compose:

volumes:
    - ./provision/sftp/etc/ssh_host_rsa_key:/etc/ssh/ssh_host_rsa_key
    - ./provision/sftp/etc/ssh_host_rsa_key.pub:/etc/ssh/ssh_host_rsa_key.pub

Those files need to be owned by root and set to 0700. Git can store the chmod bits of files just fine, but I need docker to make those files owned by root inside the container, and still owned by my local user on my host.

How do I accomplish this?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.