spearhead-docker-cli/README.md

79 lines
3.2 KiB
Markdown
Raw Permalink Normal View History

2018-02-12 17:19:15 +02:00
# Spearhead Docker CLI helper
2017-05-19 21:47:16 +03:00
2018-02-12 17:19:15 +02:00
This script will install compatible Docker versions for use with the Spearhead Cloud.
2018-02-12 17:19:15 +02:00
Your existing Docker will not be affected and you can conveniently switch between your own Docker and the Spearhead Cloud docker tools.
### Compatibility and requirements
This is designed and tested for Linux and MacOS X.
2018-02-12 17:19:15 +02:00
This code requires [Spearhead Cloud CLI tool](https://code.spearhead.cloud/Spearhead/node-spearhead) and [a Spearhead Cloud account](https://docs.spearhead.cloud/start/).
2017-05-19 21:47:16 +03:00
### Installation
In a terminal window, run the following command:
2017-05-19 21:47:16 +03:00
```bash
2018-02-12 17:19:15 +02:00
sudo bash -c 'curl -o /usr/local/bin/spearhead-docker https://code.spearhead.cloud/Spearhead/spearhead-docker-cli/raw/branch/master/spearhead-docker && chmod +x /usr/local/bin/spearhead-docker && ln -Fs /usr/local/bin/spearhead-docker /usr/local/bin/spearhead-compose && ln -Fs /usr/local/bin/spearhead-docker /usr/local/bin/spearheadn-docker-install'
2017-05-19 21:47:16 +03:00
```
2018-02-12 17:19:15 +02:00
That command will copy the `spearhead-docker` shell script from this repo, and link it as `spearhead-compose` and `spearhead-docker-install`.
2018-02-12 17:19:15 +02:00
To complete the installation, run `sudo spearhead-docker-install` to install the platform-specific versions of the Docker (now Moby) and Docker Compose CLI tools. These versions will not replace any existing Docker or Docker Compose versions you may have installed.
### Usage
2018-02-12 17:19:15 +02:00
Once installed, use `spearhead-docker` and `spearhead-compose` in place of `docker` and `docker-compose` when interacting with the Spearhead Cloud.
2017-05-20 01:19:57 +03:00
2018-02-12 17:19:15 +02:00
Start a Docker container running Nginx container on Spearhead Cloud:
2017-05-20 01:19:57 +03:00
```bash
2018-02-12 17:19:15 +02:00
$ spearhead-docker run -d -p 80 --name webserver nginx
Executing in 'ro-1' (default; use `spearhead profile set <profile name>` to change) at 05:02:41 AM
x5gso83h9365831psn43h7qwuc3115f9fitff59b2151694a963043sue94k2f73
2017-05-20 01:19:57 +03:00
$
```
2018-02-12 17:19:15 +02:00
Start [all the containers to run WordPress](https://github.com/autopilotpattern/wordpress) via Docker Compose on Spearhead Cloud:
2017-05-20 01:19:57 +03:00
```bash
2018-02-12 17:19:15 +02:00
$ spearhead-compose up -d
Executing in 'ro-1' (default; use `spearhead profile set <profile name>` to change) at 03:15:56 PM
2017-05-20 01:19:57 +03:00
Creating wp_wordpress_1
Creating wp_nginx_1
Creating wp_nfs_1
Creating wp_memcached_1
Creating wp_prometheus_1
Creating wp_mysql_1
Creating wp_consul_1
$
```
More about:
- [Docker commands on Triton](https://www.joyent.com/blog/docker-commands-on-triton)
- [Docker Compose on Triton](https://www.joyent.com/blog/using-docker-compose)
- [Optimizing your Docker operations for Triton](https://www.joyent.com/blog/optimizing-docker-on-triton)
### Triton Container Name Service helpers
This will also set some helpful environment variables for using [Triton Container Name Service (CNS)](https://docs.joyent.com/public-cloud/network/cns):
2018-02-12 17:19:15 +02:00
- `SC_CNS_SEARCH_DOMAIN_PUBLIC`
- `SC_CNS_SEARCH_DOMAIN_PRIVATE`
2018-02-12 17:19:15 +02:00
Those vars will be automatically set with values appropriate for use in Spearhead Public Cloud:
```
2018-02-12 17:19:15 +02:00
SC_CNS_SEARCH_DOMAIN_PRIVATE=a42e7881-89d2-459e-bc0b-e9af0bca409a.us-east-3.cns.spearhead.cloud
SC_CNS_SEARCH_DOMAIN_PUBLIC=a42e7881-89d2-459e-bc0b-e9af0bca409a.us-east-3.spearhead.cloud
```
### Components
In addition to the shell script in this repo, this script will install:
2018-02-12 17:19:15 +02:00
- [Moby 1.12.6](https://github.com/moby/moby/releases/tag/v1.12.6)
- [Docker Compose 1.9.0](https://github.com/docker/compose/releases/tag/1.9.0)