docker-archive / dockercloud-cli

CLI for Docker Cloud
https://cloud.docker.com/
Apache License 2.0
74 stars 40 forks source link

docker-cloud create fails, while pasting it in UI succeeds #17

Closed peterlauri closed 8 years ago

peterlauri commented 8 years ago

Information here:

https://forums.docker.com/t/docker-cloud-stack-complains-about-bad-format/8422/1

peterlauri commented 8 years ago

I installed the latest version from master commit d2e86e3 locally.

docker-cloud-bug.yml

someservice:
  image: ubuntu
  environment:
    SOME_COOL_ENV: "db286f7=15)#33$3(n(uq*(q4)ohcn!sx(gs^i#0%1t7j$t3#2"

And then when running stack create:

✗ .vedockercloud/bin/docker-cloud stack create -n bug -f docker-cloud-bug.yml
Bad format of the stack file(docker-cloud-bug.yml): Invalid interpolation format for "environment" option in service "someservice": "db286f7=15)#33$3(n(uq*(q4)ohcn!sx(gs^i#0%1t7j$t3#2"
peterlauri commented 8 years ago

I have drilled down the problem to the $-signs in the environment string. However, there should be possibility to allow a dollar sign somehow, it might be a part of a password or similar. I tried escaping, but no success... :/

fermayo commented 8 years ago

The docker-cloud CLI implements the docker-compose method of evaluating environment variables within compose files (you will notice you cannot run that compose file with docker-compose either). You will have to escape $ with $$ if you use the CLI for creating the compose stack from there.

peterlauri commented 8 years ago

Yes, I saw that when I looked into the code. However, I think better error message to the user would be a good enhancement. Such as: Environment variable substitution $asdf without asdf being present in environment. If $ is part of your environment value, escape $ as $$

fermayo commented 8 years ago

Sure, would you mind opening an issue on https://github.com/docker/compose/issues?