docker-archive / dockercloud-cli

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

dockercloud/cli doesn't seem to pick up environment vars #30

Open joaofnfernandes opened 8 years ago

joaofnfernandes commented 8 years ago

The docs say that to authenticate you need to export the environment variables:

export DOCKERCLOUD_USER=<username>
export DOCKERCLOUD_PASS=<password>

But if you export those variables and then docker run -it dockercloud/cli, you're not authenticated. But running the image with this command, seems to work:

docker run -it -e DOCKERCLOUD_USER=username -e DOCKERCLOUD_PASS=password dockercloud/cli

I've also found this forum post with a similar problem.

tifayuki commented 8 years ago

@joaofnfernandes

It is the docker-cloud binary that reads the the environment variable. If you run the cli using the container, the envvar you exposed in the shell will not be passed into the container unless you use -e.

You can use alias mentioned in the README:

alias docker-cloud="docker run -it -e DOCKERCLOUD_USER=username -e DOCKERCLOUD_PASS=password --rm dockercloud/cli"

joaofnfernandes commented 8 years ago

Ups... My first description was wrong. I meant to say that I tried

export DOCKERCLOUD_USER=<username>
export DOCKERCLOUD_PASS=<password>

docker run -it -e DOCKERCLOUD_USER -e DOCKERCLOUD_PASS dockercloud/cli

In this case the variables are passed to the container (if I do a docker exec I can see them there), but the docker-cloud binary didn't seem to be picking them,