Skip to content

Commit cddfb5b

Browse files
authored
Merge pull request #11 from bernard357/development/v1.0
be friendly with Windows users
2 parents ce3ac65 + 1b5b69f commit cddfb5b

File tree

1 file changed

+67
-31
lines changed

1 file changed

+67
-31
lines changed

docs/setup.md

Lines changed: 67 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Setup of your environment
1+
# Docker Machine with Dimension Data cloud services
22

33
Docker Machine provides a unified experience of running containers across multiple cloud platforms. On this page we focus specifically on the [Managed Cloud Platform from Dimension Data](http://cloud.dimensiondata.com/). As a software developer, you may want to handle containers at shared or at on-premises cloud facilities provided by Dimension Data. Follow instructions below and learn how to harness the power of containers, right from your laptop.
44

@@ -8,11 +8,11 @@ As a starting point, the diagram below puts Docker, Docker Machine and Docker En
88

99
[Docker](https://www.docker.com/) and [Docker Machine](https://docs.docker.com/machine/overview/) are sitting at the development workstation. Docker Machine is a tool that lets you install [Docker Engine](https://www.docker.com/products/docker-engine) on virtual hosts, and manage the hosts with `docker-machine` commands. You can use Machine to create Docker hosts on your local Mac or Windows workstation, on your company network, in your data center, or on cloud providers like AWS or Dimension Data. In other terms, Docker Machine allows software engineers to handle containers almost anywhere on Earth.
1010

11-
Docker Machine interact with any [Managed Cloud Platform](http://cloud.dimensiondata.com/), be it a public, hosted or on-premises cloud facilities delivered by Dimension Data or by one partner of the One Cloud alliance.
11+
Docker Machine interact with any [Managed Cloud Platform](http://cloud.dimensiondata.com/), be it a public, hosted or on-premises cloud facilities delivered by Dimension Data or by a partner of the One Cloud alliance.
1212

1313
## From CloudControl to Docker Machine
1414

15-
The consumption of Docker containers on the Managed Cloud Platform is based on following elements:
15+
The consumption of Docker containers on the Managed Cloud Platform requires following elements:
1616
* a working Docker and Docker Machine environment
1717
* the addition of the Docker Machine driver from Dimension Data
1818
* MCP credentials
@@ -21,7 +21,7 @@ In other terms, if you have already used the CloudControl web interface, then yo
2121

2222
## How to install Docker Machine?
2323

24-
The Docker Machine executable can be downloaded and installed directly. For example on Mac and on Linux run following command:
24+
The Docker Machine executable can be downloaded and installed directly. For example on macOS and on Linux run following command:
2525

2626
```shell
2727
$ curl -L https://github.com/docker/machine/releases/download/v0.8.2/docker-machine-`uname -s`-`uname -m` >/usr/local/bin/docker-machine
@@ -30,10 +30,9 @@ $ chmod +x /usr/local/bin/docker-machine
3030

3131
For workstations with Windows or any other operating system, you can download the latest release of Docker Machine from https://github.com/docker/machine/releases
3232

33+
As an alternative, on macOS and on Windows, Docker Machine is coming along with other Docker products when you install the Docker Toolbox. For details, check [the download page for Docker Toolbox](https://www.docker.com/products/docker-toolbox) first, then look either at [macOS installation instructions](https://docs.docker.com/toolbox/toolbox_install_mac/) or [Windows installation instructions](https://docs.docker.com/toolbox/toolbox_install_windows/).
3334

34-
As an alternative, on Mac and on Windows, Docker Machine is coming along along with other Docker products when you install the Docker Toolbox. For details, check [the download page for Docker Toolbox](https://www.docker.com/products/docker-toolbox) first, then look either at [Mac installation instructions](https://docs.docker.com/toolbox/toolbox_install_mac/) or [Windows installation instructions](https://docs.docker.com/toolbox/toolbox_install_windows/).
35-
36-
Whatever option you considered, you can quickly check the installation of Docker Machine with following command:
35+
Whatever option you consider, you can quickly check the installation of Docker Machine with following command:
3736

3837
```
3938
$ docker-machine –v
@@ -43,7 +42,27 @@ Add [the Docker Machine driver from Dimension Data](https://github.com/Dimension
4342

4443
Set your MCP credentials in the environment, and the initial password for hosts as well.
4544

46-
On Mac and Linux:
45+
On Windows there are multiple ways to set variables. You can do this by running the following in powershell:
46+
47+
```powershell
48+
$env:MCP_USER=<your-name>
49+
$env:MCP_PASSWORD=<your-password>
50+
$env:MCP_SSH_BOOTSTRAP_PASSWORD=<root-password>
51+
```
52+
53+
Alternatively, open the Configuration Panel and look for System settings. Then add system environment variables
54+
``MCP_USER``, ``MCP_PASSWORD`` and ``MCP_SSH_BOOTSTRAP_PASSWORD`` and save your changes.
55+
56+
In case you do not have access to system settings of your computer, you can still
57+
set variables temporarily in a Command Prompt session:
58+
59+
```
60+
C:\>set MCP_USER=<your-name>
61+
C:\>set MCP_PASSWORD=<your-password>
62+
C:\>set MCP_SSH_BOOTSTRAP_PASSWORD=<root-password>
63+
```
64+
65+
On macOS and Linux you should edit variables for your own user profile:
4766

4867
```
4968
$ nano ~/.bash_profile
@@ -114,7 +133,7 @@ If your containers accept other protocols over the internet then you will create
114133

115134
## How to create a host with Docker Machine?
116135

117-
Use the command `docker-machine create` with appropriate parameters, and indicate the name of the new host. The sample command below creates the machine `mcp-eu-01` at EU6:
136+
Use the command `docker-machine create` with appropriate parameters, and indicate the name of the new host. The sample command below creates the machine `mcp-eu-01` at EU6 on macOS or on Linux:
118137

119138
```bash
120139
$ docker-machine create --driver ddcloud \
@@ -126,10 +145,15 @@ $ docker-machine create --driver ddcloud \
126145
mcp-eu6-01
127146
```
128147

148+
On Windows just remove the backslashes so the whole command is on a single line.
149+
150+
```
151+
C:\>docker-machine create --driver ddcloud --ddcloud-region EU --ddcloud-datacenter EU6 --ddcloud-networkdomain 'DockerMachineFox' --ddcloud-vlan 'DockerMachineNetwork' --ddcloud-ssh-key ~/.ssh/id_rsa mcp-eu6-01
152+
```
129153
You can check the IP address of the new host, and locate security artifacts, with following command.
130154

131155
```bash
132-
$ docker-machine config mcp-eu6-01
156+
docker-machine config mcp-eu6-01
133157
```
134158

135159
The output should be similar to this:
@@ -142,16 +166,22 @@ The output should be similar to this:
142166
-H=tcp://168.128.13.169:2376
143167
```
144168

145-
Now that you have one host up and running you can activate it with following command:
169+
Now that you have one host up and running you can activate it with following command on macOS or Linux:
146170

147171
```bash
148172
$ eval $(docker-machine env mcp-eu6-01)
149173
```
150174

175+
On Windows you may have to use following command instead:
176+
177+
```
178+
C:\>@FOR /f "tokens=*" %i IN ('docker-machine env mcp-eu6-01') DO @%i
179+
```
180+
151181
As an example, let's try running the official Nginx container:
152182

153-
```bash
154-
$ docker run -d -p 8080:80 --name httpserver nginx
183+
```
184+
docker run -d -p 8080:80 --name httpserver nginx
155185
```
156186

157187
In this command, port 80 in the Nginx container is mapped to port 8080 on the host. This is meaning that we can access the default Nginx page from anywhere. Open the link in a web browser, using the IP address given by the `config` command.
@@ -169,28 +199,28 @@ Congratulations! At this stage you have created a host and deployed a container,
169199
At the Managed Cloud Platform a stopped server costs far less than a running server. Therefore, a good practice is to stop unused
170200
hosts when possible.
171201

172-
```shell
173-
$ docker-machine stop mcp-eu6-01
202+
```
203+
docker-machine stop mcp-eu6-01
174204
```
175205
You can start a host when you want using the following command.
176206

177-
```shell
178-
$ docker-machine start mcp-eu6-01
207+
```
208+
docker-machine start mcp-eu6-01
179209
```
180210

181211
If for some reason you have to restart a host, use the following command.
182212

183-
```shell
184-
$ docker-machine restart mcp-eu6-01
213+
```
214+
docker-machine restart mcp-eu6-01
185215
```
186216

187217
## How to handle multiple hosts?
188218

189219
Since it is so easy to create remote hosts with Docker Machine, you can quickly end up with several hosts.
190220
The list of hosts is shown with following command.
191221

192-
```shell
193-
$ docker-machine ls
222+
```
223+
docker-machine ls
194224
```
195225

196226
The output should be similar to this:
@@ -202,18 +232,24 @@ mcp-eu6-02 - ddcloud Running tcp://168.128.13.169:2376 v1
202232
```
203233

204234
In this example, two hosts are available and `mcp-eu6-01` is currently active. This is meaning that all `docker` commands are executed there.
205-
You can switch to another host with a command like this:
235+
You can switch to another host with a command like this on macOS and Linux:
206236

207-
```shell
237+
```bash
208238
$ eval $(docker-machine env mcp-eu6-02)
209239
```
210240

241+
And on Windows:
242+
243+
```
244+
C:\>@FOR /f "tokens=*" %i IN ('docker-machine env mcp-eu6-02') DO @%i
245+
```
246+
211247
## How to execute commands on the host?
212248

213249
Hosts created by Docker Machine are running Linux, so you can login directly:
214250

215-
```shell
216-
$ docker-machine ssh mcp-eu6-02
251+
```
252+
docker-machine ssh mcp-eu6-02
217253
```
218254

219255
Command prompt now reflects the fact that you're logged into the host as root:
@@ -226,20 +262,20 @@ Type the combination `Ctrl-D` to exit the SSH session.
226262

227263
Note that you can also run a command remotely for example.
228264

229-
```shell
230-
$ docker-machine ssh mcp-eu6-01 apt-get update
265+
```
266+
docker-machine ssh mcp-eu6-01 apt-get update
231267
```
232268

233269
Not sure what kernel your remote Docker host is using? Type the following:
234270

235-
```shell
236-
$ docker-machine ssh mcp-eu6-01 uname -r
271+
```
272+
docker-machine ssh mcp-eu6-01 uname -r
237273
```
238274

239275
## How to remove a host?
240276

241277
After this command all resources attached to the host will be lost, including permanent storage:
242278

243-
```bash
244-
$ docker-machine rm mcp-eu6-01
279+
```
280+
docker-machine rm mcp-eu6-01
245281
```

0 commit comments

Comments
 (0)