How to store server_key_rsa in docker-compose.yml?

╄→гoц情女王★ 提交于 2021-01-28 03:12:38

问题


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

It's look like that for now :

-----BEGIN RSA PRIVATE KEY-----
***********************My Key bla bla bla.......
**********************************************
**********************************************
**********************************************
**********************************************
-----END RSA PRIVATE KEY-----

And I would like to store it like that:

server_key_rsa = Here should be the key.

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..

Any idea please ?


回答1:


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


来源:https://stackoverflow.com/questions/46648085/how-to-store-server-key-rsa-in-docker-compose-yml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!