Docker tools

Modified: 24 May 2017 00:26 UTC

Docker client applications, including the Docker CLI, can connect to the Triton remote API endpoint to launch and control Docker containers on bare metal across an entire Triton data center. Each data center is a single Docker API endpoint.

Quick start

There are just three steps to using Docker on Triton:

  1. Install Docker
  2. Configure Docker for Triton
  3. Run a container

Install the Docker Engine

Install or update the Docker tools for your platform. These are the tools that run on your laptop or other environment where you develop and manage applications.

  1. Apple OS X
  2. Linux
  3. Microsoft Windows

Configure Docker for Triton

Configuring Docker for Triton requires the Triton CLI tool. With that installed, you can connect Docker on your laptop to the Triton Compute Service using the triton env command in Triton CLI version 4.9 or newer:

eval $(triton env)

That command sets all the environment variables for Docker and Triton, including:

export TRITON_PROFILE="us-sw-1"
export DOCKER_CERT_PATH=/Users/jill/.triton/docker/jill@us-sw-1_api_joyent_com
export DOCKER_HOST=tcp://
export SDC_URL=""
export SDC_ACCOUNT="jill"
unset SDC_USER
export SDC_KEY_ID="SHA256:bTh6bXMQAD2su4YOniwXsK/03Gzx8zD/hZK+X8oKUnQ"

You can use Triton CLI profiles for different data centers and different users. You can switch between profiles by specifying the profile name, as in: triton env <profile name>.

To test Docker, you can run docker info and see your account name in the output. We can see jill, our example user, in SDCAccount: jill here:

$ docker info
Containers: 0
Images: 0
Storage Driver: sdc
 SDCAccount: jill
Execution Driver: sdc-0.3.0
Logging Driver: json-file
Kernel Version: 3.12.0-1-amd64
Operating System: SmartDataCenter
CPUs: 0
Total Memory: 0 B
Name: us-sw-1
ID: 65698e31-2754-4e86-9d05-bfc881037812

If your Triton profile was created before Triton CLI version 4.9, you'll have to update it for Docker:

triton profile docker-setup <profile name>

Please see the Docker troubleshooting page or contact support if you encounter any difficulty.

Run a container

Let's create a web server to demonstrate the simplicity of Docker containers. We're going to setup a container running Nginx and copy some HTML into it. Follow the steps below to test it out:

docker run -d -p 80 --name=nginx01 nginx

That's all it takes to run a container.

That command creates a new container running the official Nginx image on Docker Hub. We use docker run -d to use daemon mode so that Nginx continues to run after the docker command finishes. We use -p 80 to expose port 80 for web traffic. We name the container so that we reference it easily later. If we didn't name it then a name would be generated for us. Finally, the last parameter selects the nginx image that we want.

Get the container IP address

To visit our new Nginx server we need to find its IP address. We can docker inspect the container to reveal its IP address. Copy the command below and open that IP in your web browser to see Nginx's default page:

$ docker inspect --format '{{ .NetworkSettings.IPAddress }}' nginx01

Containers will only have a public IP address if they have exposed ports. The private IP is only reachable by your other containers within the data center.

List containers

You can see a list of all provisioned Docker containers, including stopped containers with the -a switch to docker ps:

$ docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                    PORTS                         NAMES
828ef84a23d0        nginx               "nginx -g 'daemon off"   3 days ago          Exited (0) 25 hours ago>80/tcp, 443/tcp   ecstatic_stallman
78de959d7c96        ubuntu              "/bin/bash"              3 days ago          Exited (0) 3 days ago                                   compassionate_goodall
27d747a35429        ubuntu              "/bin/bash"              2 days ago                                                                  cranky_jepsen

Remove containers

Billing will continue on all provisioned Docker containers, including those that are stopped. To avoid charges for stopped or unwanted containers, be sure to remove them. Let's clean up the example we were using above:

$ docker rm -f nginx01

What next?

Please check out the Docker user guide and our blog posts to learn more about building infrastructure with Docker on Triton.

Docker CLI commands

Documentation for specific Docker commands and any variance in the implementation in Triton is documented in the full API docs and for each command individually:

For full documentation of Docker commands in Triton, see

Comparing Docker API and CloudAPI/Triton CLI commands

Docker API access on Triton works in parrallel with CloudAPI. Many Docker CLI commands have equivilent commands in the Triton CLI (the Triton CLI tool uses CloudAPI).

Purpose Docker API CloudAPI
List containers docker ps triton instances or triton instance list
Get details for container by name or UUID docker inspect <name or UUID> triton instance get <name or UUID>
Get IPs for container --format '{{ .NetworkSettings.IPAddress }}' <name or UUID> or docker inspect <name or UUID> | json -aH NetworkSettings triton instance ip <name or UUID> or triton instance get -j <name or UUID> | json primaryIp
Create and start a new container docker run <image name> triton instance create <image name or UUID> <package name or UUID>
Create, but don't start, a container docker create <image name> Not supported in CloudAPI
Start a stopped container docker start <name or UUID> triton instance start <name or UUID>
Restart a container docker restart <name or UUID> triton instance reboot <name or UUID>
Stop a container docker stop <name or UUID> triton instance stop <name or UUID>
Remove container docker rm <name or UUID> triton instance delete <name or UUID>
Stop and remove all containers (use with great caution) docker rm -f $(docker ps -a -q) triton instance delete $(triton instances -Ho shortid)
Get shell in a container1 docker exec -it <name or UUID> bash triton ssh <name or UUID>
List images docker images triton images or triton image list
Get image history/layers docker history <name or UUID> ---
Get image metadata Not supported in Docker triton image get <image UUID>
Import/download a new image docker pull <name or UUID> ---
Remove an image from user's view docker rmi <name or UUID> ---
Permanently delete an image2 --- triton image delete <image UUID>

Docker version

Triton supports clients using Docker Remote API v1.19 and above. For the Docker CLI, this includes Docker 1.7.1 and above. For Docker Compose, this includes version 1.4.1 and above.

  1. Technically, the Docker command is using the Docker API to execute an appliction (bash in this case) inside the container and passing the input and output via Docker API to your local shell. The Triton CLI example here is a convenience for starting SSH in your local shell, and all communication is via normal SSH. 

  2. You can only delete your custom images, not any of Joyent's pre-created images.