Work with Docker containers

Modified: 20 Sep 2017 18:09 UTC

The Docker API implementation on Triton runs parallel with Triton's own CloudAPI, and the containers you provision using the Docker API run along side the infrastructure containers and hardware VMs you can start using CloudAPI.

Docker API and CloudAPI side-by-side

On Triton, you can have a single view of your bare-metal Docker containers, infrastructure containers, and hardware VMs.

Once triton-docker has been installed, you'll be able to run containers on Triton. Get started:

Docker commands and options to avoid

Triton Elastic Docker Host supports most of the features of Docker's 1.22 spec. That means you can do most everything you'd expect to do, but there are a few exceptions:

Comparing Docker API and CloudAPI/Triton CLI commands

Docker API access on Triton works in parallel with CloudAPI. Many Docker API commands (which use the Triton Docker CLI tool) have equivalent commands in CloudAPI (which uses the Triton CLI).

Purpose Docker API CloudAPI
List containers triton-docker ps triton instances or triton instance list
Get details for container by name or UUID triton-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 triton-docker run <image name> triton instance create <image name or UUID> <package name or UUID>
Create, but don't start, a container triton-docker create <image name> Not supported in CloudAPI
Start a stopped container triton-docker start <name or UUID> triton instance start <name or UUID>
Restart a container triton-docker restart <name or UUID> triton instance reboot <name or UUID>
Stop a container triton-docker stop <name or UUID> triton instance stop <name or UUID>
Remove container triton-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 triton-docker exec -it <name or UUID> bash triton ssh <name or UUID>
List images triton-docker images triton images or triton image list
Get image history/layers triton-docker history <name or UUID> ---
Get image metadata Not supported in Docker triton image get <image UUID>
Import/download a new image triton-docker pull <name or UUID> ---
Remove an image from user's view triton-docker rmi <name or UUID> ---
Permanently delete an image2 --- triton image delete <image UUID>

  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.