如何在docker-compose.yml中存储server_key_rsa? [英] How to store server_key_rsa in docker-compose.yml?
问题描述
我需要将sftpServer的server_key_rsa存储在docker-compose.yml中,但我不知道如何存储
I need to store the server_key_rsa of my sftpServer in a docker-compose.yml but I don't know how to store it
现在看起来像这样:
-----BEGIN RSA PRIVATE KEY-----
***********************My Key bla bla bla.......
**********************************************
**********************************************
**********************************************
**********************************************
-----END RSA PRIVATE KEY-----
我想这样存储它:
server_key_rsa =这应该是密钥.
server_key_rsa = Here should be the key.
我尝试使用"|"在我输入密钥之前,我尝试将密钥文件更改为Base64,在行之间尝试了"\ n",然后尝试了"the \ nrsa \ nkey",但是这些解决方案均失败了..
I tried with "|" just before my key, I tried to change my key file to Base64, I tried "\n" between lines, I tried "the\nrsa\nkey", but those solutions failed..
请问有什么想法吗?
推荐答案
The secrets definition in the docker-compose.yml file, as of version 3.3 of the file format, does not support passing the content of the secret inside the docker-compose.yml file itself. The secret needs to be either external (predefined with docker secret create secret_name -
) or from the contents of a separate file.
具有外部定义的机密的语法为:
The syntax with an externally defined secret is:
secrets:
my_first_secret:
file: ./secret_data
my_second_secret:
external: true
包含您的机密的单独文件的语法为:
And the syntax for a separate file containing your secret is:
secrets:
my_first_secret:
file: ./secret_data
my_second_secret:
external:
name: redis_secret
这篇关于如何在docker-compose.yml中存储server_key_rsa?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!