Skip to content

Commit aab444d

Browse files
Update cloud-ex-machine-ocean.md
1 parent b5a4232 commit aab444d

File tree

1 file changed

+104
-88
lines changed

1 file changed

+104
-88
lines changed

engine/installation/cloud/cloud-ex-machine-ocean.md

Lines changed: 104 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,23 @@ If you have not done so already, go to <a href="https://digitalocean.com" target
2727

2828
To generate your access token:
2929

30-
1. Go to the Digital Ocean administrator console and click **API** in the header.
30+
1. Go to the Digital Ocean administrator console and click **API** in the header.
3131

32-
![Click API in Digital Ocean console](../images/ocean_click_api.png)
32+
![Click API in Digital Ocean console](../images/ocean_click_api.png)
3333

34-
2. Click **Generate New Token** to get to the token generator.
34+
2. Click **Generate New Token** to get to the token generator.
3535

36-
![Generate token](../images/ocean_gen_token.png)
36+
![Generate token](../images/ocean_gen_token.png)
3737

38-
3. Give the token a clever name (e.g. "machine"), make sure the **Write (Optional)** checkbox is checked, and click **Generate Token**.
38+
3. Give the token a clever name (e.g. "machine"), make sure the **Write (Optional)** checkbox is checked, and click **Generate Token**.
3939

40-
![Name and generate token](../images/ocean_token_create.png)
40+
![Name and generate token](../images/ocean_token_create.png)
4141

42-
4. Grab (copy to clipboard) the generated big long hex string and store it somewhere safe.
42+
4. Grab (copy to clipboard) the generated big long hex string and store it somewhere safe.
4343

44-
![Copy and save personal access token](../images/ocean_save_token.png)
44+
![Copy and save personal access token](../images/ocean_save_token.png)
4545

46-
This is the personal access token you'll use in the next step to create your cloud server.
46+
This is the personal access token you'll use in the next step to create your cloud server.
4747

4848
### Step 3. Install Docker Machine
4949

@@ -57,111 +57,127 @@ To generate your access token:
5757

5858
2. At a command terminal, use `docker-machine ls` to get a list of Docker Machines and their status.
5959

60-
$ docker-machine ls
61-
NAME ACTIVE DRIVER STATE URL SWARM
62-
default * virtualbox Running tcp:////xxx.xxx.xx.xxx:xxxx
60+
```
61+
$ docker-machine ls
62+
NAME ACTIVE DRIVER STATE URL SWARM
63+
default * virtualbox Running tcp:////xxx.xxx.xx.xxx:xxxx
64+
```
6365
64-
6. Run some Docker commands to make sure that Docker Engine is also up-and-running.
66+
6. Run some Docker commands to make sure that Docker Engine is also up-and-running.
6567
6668
We'll run `docker run hello-world` again, but you could try `docker ps`, `docker run docker/whalesay cowsay boo`, or another command to verify that Docker is running.
6769
68-
$ docker run hello-world
70+
```
71+
$ docker run hello-world
6972
70-
Hello from Docker.
71-
This message shows that your installation appears to be working correctly.
72-
...
73+
Hello from Docker.
74+
This message shows that your installation appears to be working correctly.
75+
...
76+
```
7377
7478
### Step 4. Use Machine to Create the Droplet
7579
76-
1. Run `docker-machine create` with the `digitalocean` driver and pass your key to the `--digitalocean-access-token` flag, along with a name for the new cloud server.
80+
1. Run `docker-machine create` with the `digitalocean` driver and pass your key to the `--digitalocean-access-token` flag, along with a name for the new cloud server.
7781
7882
For this example, we'll call our new Droplet "docker-sandbox".
7983
80-
$ docker-machine create --driver digitalocean --digitalocean-access-token xxxxx docker-sandbox
81-
Running pre-create checks...
82-
Creating machine...
83-
(docker-sandbox) OUT | Creating SSH key...
84-
(docker-sandbox) OUT | Creating Digital Ocean droplet...
85-
(docker-sandbox) OUT | Waiting for IP address to be assigned to the Droplet...
86-
Waiting for machine to be running, this may take a few minutes...
87-
Machine is running, waiting for SSH to be available...
88-
Detecting operating system of created instance...
89-
Detecting the provisioner...
90-
Provisioning created instance...
91-
Copying certs to the local machine directory...
92-
Copying certs to the remote machine...
93-
Setting Docker configuration on the remote daemon...
94-
To see how to connect Docker to this machine, run: docker-machine env docker-sandbox
84+
```
85+
$ docker-machine create --driver digitalocean --digitalocean-access-token xxxxx docker-sandbox
86+
Running pre-create checks...
87+
Creating machine...
88+
(docker-sandbox) OUT | Creating SSH key...
89+
(docker-sandbox) OUT | Creating Digital Ocean droplet...
90+
(docker-sandbox) OUT | Waiting for IP address to be assigned to the Droplet...
91+
Waiting for machine to be running, this may take a few minutes...
92+
Machine is running, waiting for SSH to be available...
93+
Detecting operating system of created instance...
94+
Detecting the provisioner...
95+
Provisioning created instance...
96+
Copying certs to the local machine directory...
97+
Copying certs to the remote machine...
98+
Setting Docker configuration on the remote daemon...
99+
To see how to connect Docker to this machine, run: docker-machine env docker-sandbox
100+
```
95101
96102
When the Droplet is created, Docker generates a unique SSH key and stores it on your local system in `~/.docker/machines`. Initially, this is used to provision the host. Later, it's used under the hood to access the Droplet directly with the `docker-machine ssh` command. Docker Engine is installed on the cloud server and the daemon is configured to accept remote connections over TCP using TLS for authentication.
97103
98-
2. Go to the Digital Ocean console to view the new Droplet.
104+
2. Go to the Digital Ocean console to view the new Droplet.
99105
100-
![Droplet in Digital Ocean created with Machine](../images/ocean_droplet.png)
106+
![Droplet in Digital Ocean created with Machine](../images/ocean_droplet.png)
101107
102-
3. At the command terminal, run `docker-machine ls`.
108+
3. At the command terminal, run `docker-machine ls`.
103109
104-
$ docker-machine ls
105-
NAME ACTIVE DRIVER STATE URL SWARM
106-
default * virtualbox Running tcp://192.168.99.100:2376
107-
docker-sandbox - digitalocean Running tcp://45.55.139.48:2376
110+
```
111+
$ docker-machine ls
112+
NAME ACTIVE DRIVER STATE URL SWARM
113+
default * virtualbox Running tcp://192.168.99.100:2376
114+
docker-sandbox - digitalocean Running tcp://45.55.139.48:2376
115+
```
108116
109117
Notice that the new cloud server is running but is not the active host. Our command shell is still connected to the default machine, which is currently the active host as indicated by the asterisk (*).
110118
111119
4. Run `docker-machine env docker-sandbox` to get the environment commands for the new remote host, then run `eval` as directed to re-configure the shell to connect to `docker-sandbox`.
112120
113-
$ docker-machine env docker-sandbox
114-
export DOCKER_TLS_VERIFY="1"
115-
export DOCKER_HOST="tcp://45.55.222.72:2376"
116-
export DOCKER_CERT_PATH="/Users/victoriabialas/.docker/machine/machines/docker-sandbox"
117-
export DOCKER_MACHINE_NAME="docker-sandbox"
118-
# Run this command to configure your shell:
119-
# eval "$(docker-machine env docker-sandbox)"
120-
121-
$ eval "$(docker-machine env docker-sandbox)"
122-
123-
5. Re-run `docker-machine ls` to verify that our new server is the active machine, as indicated by the asterisk (*) in the ACTIVE column.
124-
125-
$ docker-machine ls
126-
NAME ACTIVE DRIVER STATE URL SWARM
127-
default - virtualbox Running tcp://192.168.99.100:2376
128-
docker-sandbox * digitalocean Running tcp://45.55.222.72:2376
129-
130-
6. Run some `docker-machine` commands to inspect the remote host. For example, `docker-machine ip <machine>` gets the host IP address and `docker-machine inspect <machine>` lists all the details.
131-
132-
$ docker-machine ip docker-sandbox
133-
104.131.43.236
134-
135-
$ docker-machine inspect docker-sandbox
136-
{
137-
"ConfigVersion": 3,
138-
"Driver": {
139-
"IPAddress": "104.131.43.236",
140-
"MachineName": "docker-sandbox",
141-
"SSHUser": "root",
142-
"SSHPort": 22,
143-
"SSHKeyPath": "/Users/samanthastevens/.docker/machine/machines/docker-sandbox/id_rsa",
144-
"StorePath": "/Users/samanthastevens/.docker/machine",
145-
"SwarmMaster": false,
146-
"SwarmHost": "tcp://0.0.0.0:3376",
147-
"SwarmDiscovery": "",
148-
...
149-
150-
7. Verify Docker Engine is installed correctly by running `docker` commands.
121+
```
122+
$ docker-machine env docker-sandbox
123+
export DOCKER_TLS_VERIFY="1"
124+
export DOCKER_HOST="tcp://45.55.222.72:2376"
125+
export DOCKER_CERT_PATH="/Users/victoriabialas/.docker/machine/machines/docker-sandbox"
126+
export DOCKER_MACHINE_NAME="docker-sandbox"
127+
# Run this command to configure your shell:
128+
# eval "$(docker-machine env docker-sandbox)"
129+
130+
$ eval "$(docker-machine env docker-sandbox)"
131+
```
132+
133+
5. Re-run `docker-machine ls` to verify that our new server is the active machine, as indicated by the asterisk (*) in the ACTIVE column.
134+
135+
```
136+
$ docker-machine ls
137+
NAME ACTIVE DRIVER STATE URL SWARM
138+
default - virtualbox Running tcp://192.168.99.100:2376
139+
docker-sandbox * digitalocean Running tcp://45.55.222.72:2376
140+
```
141+
142+
6. Run some `docker-machine` commands to inspect the remote host. For example, `docker-machine ip <machine>` gets the host IP address and `docker-machine inspect <machine>` lists all the details.
143+
144+
```
145+
$ docker-machine ip docker-sandbox
146+
104.131.43.236
147+
148+
$ docker-machine inspect docker-sandbox
149+
{
150+
"ConfigVersion": 3,
151+
"Driver": {
152+
"IPAddress": "104.131.43.236",
153+
"MachineName": "docker-sandbox",
154+
"SSHUser": "root",
155+
"SSHPort": 22,
156+
"SSHKeyPath": "/Users/samanthastevens/.docker/machine/machines/docker-sandbox/id_rsa",
157+
"StorePath": "/Users/samanthastevens/.docker/machine",
158+
"SwarmMaster": false,
159+
"SwarmHost": "tcp://0.0.0.0:3376",
160+
"SwarmDiscovery": "",
161+
...
162+
```
163+
164+
7. Verify Docker Engine is installed correctly by running `docker` commands.
151165
152166
Start with something basic like `docker run hello-world`, or for a more interesting test, run a Dockerized webserver on your new remote machine.
153167
154168
In this example, the `-p` option is used to expose port 80 from the `nginx` container and make it accessible on port `8000` of the `docker-sandbox` host.
155169
156-
$ docker run -d -p 8000:80 --name webserver kitematic/hello-world-nginx
157-
Unable to find image 'kitematic/hello-world-nginx:latest' locally
158-
latest: Pulling from kitematic/hello-world-nginx
159-
a285d7f063ea: Pull complete
160-
2d7baf27389b: Pull complete
161-
...
162-
Digest: sha256:ec0ca6dcb034916784c988b4f2432716e2e92b995ac606e080c7a54b52b87066
163-
Status: Downloaded newer image for kitematic/hello-world-nginx:latest
164-
942dfb4a0eaae75bf26c9785ade4ff47ceb2ec2a152be82b9d7960e8b5777e65
170+
```
171+
$ docker run -d -p 8000:80 --name webserver kitematic/hello-world-nginx
172+
Unable to find image 'kitematic/hello-world-nginx:latest' locally
173+
latest: Pulling from kitematic/hello-world-nginx
174+
a285d7f063ea: Pull complete
175+
2d7baf27389b: Pull complete
176+
...
177+
Digest: sha256:ec0ca6dcb034916784c988b4f2432716e2e92b995ac606e080c7a54b52b87066
178+
Status: Downloaded newer image for kitematic/hello-world-nginx:latest
179+
942dfb4a0eaae75bf26c9785ade4ff47ceb2ec2a152be82b9d7960e8b5777e65
180+
```
165181
166182
In a web browser, go to `http://<host_ip>:8000` to bring up the webserver home page. You got the `<host_ip>` from the output of the `docker-machine ip <machine>` command you ran in a previous step. Use the port you exposed in the `docker run` command.
167183
@@ -197,6 +213,6 @@ If you create a host with Docker Machine, but remove it through the cloud provid
197213
198214
* [Use Docker Machine to provision hosts on cloud providers](https://docs.docker.com/machine/get-started-cloud/)
199215
200-
* [Install Docker Engine](../../installation/index.md)
216+
* [Install Docker Engine](../../installation/index.md)
201217
202218
* [Docker User Guide](../../userguide/intro.md)

0 commit comments

Comments
 (0)