The Docker Cloud CLI

Estimated reading time:
4 minutes

Docker Cloud maintains a Command Line Interface (CLI) tool that you can use
to interact with the service. We highly recommend installing the CLI, as it
allows you to script and automate actions in Docker Cloud without using the web
interface. If you only ever use the web interface, this is not necessary.

Install

Install the docker-cloud CLI either by running a Docker container, or by using the package manager for your system.

Run the CLI in a Docker container

If you have Docker Engine installed locally, you can run the following docker
command in your shell regardless of which operating system you are using.

$ docker run dockercloud/cli -h

This command runs the docker-cloud CLI image in a container for you. Learn
more about how to use this container
here.

Install for Linux or Windows

You can install the CLI locally using the pip
package manager, which is a package manager for
Python applications.

If you already have Python 2.x or 3.x installed, you probably have pip and
setuptools, but need to upgrade per the instructions
here.

What’s next?

Use the docker-cloud CLI with an organization

When you use the docker-cloud CLI, it authenticates against the Docker Cloud
service with the user credentials saved by the docker login command. To use
the CLI to interact with objects belonging to an Organization, you
must override the DOCKERCLOUD_NAMESPACE environment variable that sets this
user.

For example:

$ export DOCKERCLOUD_NAMESPACE=myorganization

You can also set the DOCKERCLOUD_NAMESPACE variable before each CLI command.
For example: