Joyent Triton Container Driver Documentation¶
Joyent Triton is a Docker hosting service, provided by service provider Joyent. Docker-native tools and elastic hosts make deploying on Triton as easy as running Docker on your laptop. There is no special software to install or configure. Mix Docker containers with container-native Linux to extend the benefits of containerization to legacy applications and stateful services.

Instantiating the driver¶
Download the script:
curl -O https://raw.githubusercontent.com/joyent/sdc-docker/master/tools/sdc-docker-setup.sh
Now execute the script, substituting the correct values:
bash sdc-docker-setup.sh <CLOUDAPI_URL> <ACCOUNT_USERNAME> ~/.ssh/<PRIVATE_KEY_FILE>
This should output something similar to the following:
Setting up Docker client for SDC using:
CloudAPI: https://us-east-1.api.joyent.com
Account: jill
Key: /Users/localuser/.ssh/sdc-docker.id_rsa
If you have a pass phrase on your key, the openssl command will
prompt you for your pass phrase now and again later.
Verifying CloudAPI access.
CloudAPI access verified.
Generating client certificate from SSH private key.
writing RSA key
Wrote certificate files to /Users/localuser/.sdc/docker/jill
Get Docker host endpoint from cloudapi.
Docker service endpoint is: tcp://us-east-1.docker.joyent.com:2376
* * *
Success. Set your environment as follows:
export DOCKER_CERT_PATH=/Users/localuser/.sdc/docker/jill
export DOCKER_HOST=tcp://us-east-1.docker.joyent.com:2376
export DOCKER_CLIENT_TIMEOUT=300
export DOCKER_TLS_VERIFY=1
from libcloud.container.types import Provider
from libcloud.container.providers import get_driver
cls = get_driver(Provider.JOYENT)
conn = cls(
host="us-east-1.docker.joyent.com",
port=2376,
key_file="key.pem",
cert_file="~/.sdc/docker/admin/ca.pem",
)
conn.list_images()
API Docs¶
- class libcloud.container.drivers.joyent.JoyentContainerDriver(key=None, secret=None, secure=False, host='localhost', port=2376, key_file=None, cert_file=None)[source]¶
Joyent Triton container driver class.
>>> from libcloud.container.providers import get_driver >>> driver = get_driver('joyent') >>> conn = driver(host='https://us-east-1.docker.joyent.com', port=2376, key_file='key.pem', cert_file='cert.pem')
- Parameters:
key (
str
) – API key or username to used (required)secret (
str
) – Secret password to be used (required)secure (
bool
) – Whether to use HTTPS or HTTP. Note: Some providers only support HTTPS, and it is on by default.host (
str
) – Override hostname used for connections.port (
int
) – Override port used for connections.key_file (
str
) – Path to private key for TLS connection (optional)cert_file (
str
) – Path to public key for TLS connection (optional)
- Returns:
None
- connectionCls¶
alias of
DockerConnection
- create_cluster(name: str, location: Optional[ClusterLocation] = None) ContainerCluster ¶
Create a container cluster
- Parameters:
name (
str
) – The name of the clusterlocation (
ClusterLocation
) – The location to create the cluster in
- Return type:
- deploy_container(name, image, parameters=None, start=True, command=None, hostname=None, user='', stdin_open=True, tty=True, mem_limit=0, ports=None, environment=None, dns=None, volumes=None, volumes_from=None, network_disabled=False, entrypoint=None, cpu_shares=None, working_dir='', domainname=None, memswap_limit=0, port_bindings=None, network_mode='bridge', labels=None)¶
Deploy an installed container image
For details on the additional parameters see : http://bit.ly/1PjMVKV
- Parameters:
name (
str
) – The name of the new containerimage (
libcloud.container.base.ContainerImage
) – The container image to deployparameters (
str
) – Container Image parametersstart (
bool
) – Start the container on deployment
- Return type:
Container
- destroy_cluster(cluster: ContainerCluster) bool ¶
Delete a cluster
- Returns:
True
if the destroy was successful, otherwiseFalse
.- Return type:
bool
- destroy_container(container)¶
Remove a container
- Parameters:
container (
libcloud.container.base.Container
) – The container to be destroyed- Returns:
True if the destroy was successful, False otherwise.
- Return type:
bool
- ex_delete_image(image)¶
Remove image from the filesystem
- Parameters:
image (
libcloud.container.base.ContainerImage
) – The image to remove- Return type:
bool
- ex_get_logs(container, stream=False)¶
Get container logs
If stream == True, logs will be yielded as a stream From Api Version 1.11 and above we need a GET request to get the logs Logs are in different format of those of Version 1.10 and below
- Parameters:
container (
libcloud.container.base.Container
) – The container to list logs forstream (
bool
) – Stream the output
- Return type:
bool
- ex_list_processes(container)¶
List processes running inside a container
- Parameters:
container (
libcloud.container.base.Container
) – The container to list processes for.- Return type:
str
- ex_rename_container(container, name)¶
Rename a container
- Parameters:
container (
libcloud.container.base.Container
) – The container to be renamedname (
str
) – The new name
- Return type:
- ex_search_images(term)¶
Search for an image on Docker.io. Returns a list of ContainerImage objects
>>> images = conn.ex_search_images(term='mistio') >>> images [<ContainerImage: id=rolikeusch/docker-mistio...>, <ContainerImage: id=mist/mistio, name=mist/mistio, driver=Docker ...>]
- param term:
The search term
- type term:
str
- rtype:
- get_cluster(id: str) ContainerCluster ¶
Get a cluster by ID
- Parameters:
id (
str
) – The ID of the cluster to get- Return type:
- get_container(id)¶
Get a container by ID
- Parameters:
id (
str
) – The ID of the container to get- Return type:
- install_image(path)¶
Install a container image from a remote path.
- Parameters:
path (
str
) – Path to the container image- Return type:
- list_clusters(location: Optional[ClusterLocation] = None) List[ContainerCluster] ¶
Get a list of potential locations to deploy clusters into
- Parameters:
location (
ClusterLocation
) – The location to search in- Return type:
list
ofContainerCluster
- list_containers(image=None, all=True)¶
List the deployed container images
- Parameters:
image (
libcloud.container.base.ContainerImage
) – Filter to containers with a certain imageall (
bool
) – Show all container (including stopped ones)
- Return type:
- list_images()¶
List the installed container images
- Return type:
- list_locations() List[ClusterLocation] ¶
Get a list of potential locations to deploy clusters into
- Return type:
list
ofClusterLocation
- restart_container(container)¶
Restart a container
- Parameters:
container (
libcloud.container.base.Container
) – The container to be stopped- Returns:
The container refreshed with current data
- Return type:
- start_container(container)¶
Start a container
- Parameters:
container (
libcloud.container.base.Container
) – The container to be started- Returns:
The container refreshed with current data
- Return type:
- stop_container(container)¶
Stop a container
- Parameters:
container (
libcloud.container.base.Container
) – The container to be stopped- Returns:
The container refreshed with current data
- Return type:
- supports_clusters = False¶
Whether the driver supports containers being deployed into clusters