Docker CLI
Docker quick start
First, we need to change our shell's environment for the docker
command to
communicate with our remote docker API instead of the local docker host.
Note: this example assumes you're using a profile with CloudAPI URL set to data center
lev-1
The following command shows your currently selected profile (indicated by an *)
triton profile list
Change the shell's environment:
eval "$(triton env --docker)"
Start a showcase docker instance using the official getting-started docker image:
docker run -d -p 80:80 --name docker-test --label triton.cns.services=test docker/getting-started
Note: the following error message is normal and can safely be ignored:
ERRO[0056] error getting events from daemon: Error response from daemon: (NotImplemented) events is not implemented (de10cf54-7111-4301-9a0f-c1ba6766ea8b)
You can ping
the new instance like this:
ping test.svc.$(triton account get --json | json id).lev-1.greenbaum.zone
Hint: by setting the
--label triton.cns.services=test
, a DNS record is automatically generated that you can use as target in a CNAME record of your own domain. The auto-generated DNS record for public IPs always looks like this:# template ${label}.svc.${account_uuid}.${data_center}.greenbaum.zone # example test.svc.9ff951c9-1dc7-6e21-9548-f68f5547636d.lev-1.greenbaum.zone
You can set the same label on multiple instances and they will all be reachable via that single DNS record.
You can find out your account's UUID with this command:
triton account get --json | json id
Only in tritonshell:
tritonshell
conveniently populates your shell environment with variables to
easily use the generated DNS records:
ping test.svc.$TRITON_CNS_SEARCH_DOMAIN_PUBLIC
Show running docker instances:
docker ps
Connect to your docker instance:
docker exec -it docker-test sh
Stop the docker instance:
docker stop docker-test
Remove docker instances:
docker rm docker-test