You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
65
67
66
68
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.
67
69
68
-
$ docker run hello-world
70
+
```
71
+
$ docker run hello-world
69
72
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
+
```
73
77
74
78
### Step 4. Use Machine to Create the Droplet
75
79
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.
77
81
78
82
For this example, we'll call our new Droplet "docker-sandbox".
(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
+
```
95
101
96
102
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.
97
103
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.
99
105
100
-

106
+

101
107
102
-
3. At the command terminal, run `docker-machine ls`.
108
+
3. At the command terminal, run `docker-machine ls`.
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 (*).
110
118
111
119
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`.
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.
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.
7. Verify Docker Engine is installed correctly by running `docker` commands.
151
165
152
166
Start with something basic like `docker run hello-world`, or for a more interesting test, run a Dockerized webserver on your new remote machine.
153
167
154
168
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.
155
169
156
-
$ docker run -d -p 8000:80 --name webserver kitematic/hello-world-nginx
157
-
Unable to find image 'kitematic/hello-world-nginx:latest' locally
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.
167
183
@@ -197,6 +213,6 @@ If you create a host with Docker Machine, but remove it through the cloud provid
197
213
198
214
* [Use Docker Machine to provision hosts on cloud providers](https://docs.docker.com/machine/get-started-cloud/)
0 commit comments