Getting started

Orchard gives you a Docker host in the cloud that works just like a local one. You can use it run one-off commands, run long-running daemons, build images and anything else you can do with Docker.

(If you don’t know what Docker is, you’re in for a treat. It makes it really easy to build containers, which you can think of as lightweight virtual machines that let you package up an application and run it anywhere.)

Installation

To get started, you’ll first need to install the official Docker client if you don’t have it already. Either follow the installation instructions for Ubuntu or download the Mac OS X client:

$ curl https://get.docker.io/builds/Darwin/x86_64/docker-1.1.1 > /usr/local/bin/docker
$ chmod +x /usr/local/bin/docker
Note: Orchard runs Docker 1.1.1. Different versions of the Docker CLI may be incompatible.

Next, install the orchard command-line tool:

$ curl -L https://github.com/orchardup/go-orchard/releases/download/2.1.0/darwin > /usr/local/bin/orchard
$ chmod +x /usr/local/bin/orchard

You can now create a Docker host. Since this is the first run, you’ll be asked for your login details:

$ orchard hosts create
Orchard username: exampleuser
Password:
Default host running at 162.243.1.25

Talking to your remote Docker host is done via the orchard docker sub-command.

$ orchard docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

orchard docker simply wraps the official Docker CLI—any command that works against a local Docker host will work against Orchard.

Start a container

First, let’s do the simplest thing possible.

$ orchard docker run ubuntu echo hello world
hello world

docker run starts a container with the given image and run command. Orchard just started a remote container, ran a command on it, collected its output and shut it down.

Start a Redis server

Now let’s start a Redis server.

$ orchard docker run -p 6379:6379 -d orchardup/redis
Unable to find image 'orchardup/redis' (tag: latest) locally
Pulling repository orchardup/redis
f7ed8f015263: Download complete
8dbd9e392a96: Download complete
022103eaa5b7: Download complete
76c9266541cf: Download complete
1543808826aa: Download complete
8c7154aa0975: Download complete
4b0d70d8b80c: Download complete
eaf632fe878c: Download complete
c4dbc68c9a10: Download complete
1d23ca7c7614: Download complete
5124a607f3fa94cefeaffe1f51e2a184632c5bf4699285e702c58f03e1147908

A few things to note:

  • The -p flag maps port 6379 on the host to the same port on our container.
  • The -d flag makes it run in “detached” mode, so we don’t attach our terminal to the process.
  • Rather than installing Redis from scratch, we used the orchardup/redis image from the Docker public index of images.
  • Once the container has started, its ID is printed to stdout.

We’ve now got a Redis server running! We can confirm that it’s up with ps:

$ orchard docker ps
CONTAINER ID        IMAGE                    COMMAND               CREATED              STATUS              PORTS                    NAMES
5124a607f3fa        orchardup/redis:latest   /usr/local/bin/run    About a minute ago   Up About a minute   0.0.0.0:6379->6379/tcp   thirsty_morse

There it is. We can get the IP of our Docker host with orchard hosts:

$ orchard hosts
NAME                IP
default             162.243.1.25

If you telnet to the host’s IP address at port 6379, you can interact with it using the Redis protocol.

$ telnet 162.243.1.25 6379
Trying 162.243.1.25...
Connected to 162.243.1.25.
Escape character is '^]'.
SET foo 1
+OK
INCR foo
:2
QUIT
+OK
Connection closed by foreign host.

Once you’ve finished, you can stop the container, passing the ID (or auto-generated name):

$ orchard docker stop 5124a607f3fa
Stopped 5124a607f3fa

Start a custom container

Finally, let’s demonstrate how easy it is to get your own stuff running on Orchard. Create a fresh directory and put a Dockerfile inside it, with this content:

FROM dockerfile/nodejs

ADD . /code
CMD node /code/server.js

Next, create a server.js with this content:

var http = require('http');

http.createServer(function(req, res) {
  res.end("Hello World!");
}).listen(80);

To get this (very simple) app running on Orchard, do a build followed by a run:

$ orchard docker build -t node-example .
$ orchard docker run -d -p 80:80 node-example

You should then be able to point your browser at your host’s IP address (remember, you can get that with orchard hosts).

Removing your host

Hosts are charged based on how long they’re around for, so if you’re done, you can remove it:

$ orchard hosts rm

That’s the basics covered! Try creating a PostgreSQL server next, or deploying a simple Python web app.