Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pass Json file content in docker-compose.yml

I need to pass contents of JSON file as value of environment variable USER_PASS in docker-compose.yml file. The docker-compose.yml file looks like following:

  watchtower:
    image: v2tec/watchtower
    environment:
      - REPO_USER=_json_key
      - REPO_PASS=?????

and Json file looks as follows:

{
  "type": "service_account",
  "project_id": "xxx",
  ....
}

I tried passing the Json text in many ways like surrounding it with single quotes, removing new line etc but nothing is working. Any idea how to accomplish this?

like image 503
Lokesh Avatar asked Sep 18 '25 04:09

Lokesh


1 Answers

I just removed all the spaces along with new line characters and it worked.

like image 147
Lokesh Avatar answered Sep 20 '25 18:09

Lokesh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!