Skip to content

Commit 2d9a483

Browse files
committed
initial release of the setup page
1 parent 8719ce6 commit 2d9a483

File tree

3 files changed

+227
-14
lines changed

3 files changed

+227
-14
lines changed

docs/architecture.png

5.18 KB
Loading

docs/nginx.png

20 KB
Loading

docs/setup.md

Lines changed: 227 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,242 @@
11
# Setup of your environment
22

3-
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/eu/en/). 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.
3+
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

55
As a starting point, the diagram below puts Docker, Docker Machine and Docker Engine in context.
66

77
![Architecture](architecture.png)
88

9-
## Install Docker Machine on development workstation
9+
[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-
* install Docker Machine
12-
* add the driver from Dimension Data
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.
1312

14-
## Prepare target environment on MCP
13+
## From CloudControl to Docker Machine
1514

16-
* select a MCP
17-
* create a Network Domain
18-
* add a VLAN
19-
* add some firewall rules
15+
The consumption of Docker containers on the Managed Cloud Platform is based on following elements:
16+
* a working Docker and Docker Machine environment
17+
* the addition of the Docker Machine driver from Dimension Data
18+
* MCP credentials
2019

21-
## How to create a Docker Engine host with Docker Machine?
20+
In other terms, if you have already used the CloudControl web interface, then you are fully eligible to consume Docker containers as well, right from your workstation.
2221

23-
* sample command
24-
* run a simple command (hello-world)
22+
## How to install Docker Machine?
23+
24+
On Mac and on Windows, Docker Machine is installed 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/).
25+
26+
As an alternative to the installation of the full Docker Toolbox, you may prefer the direct download of the Docker Machine executable. For example on Mac and on Linux:
27+
28+
```shell
29+
$ curl -L https://github.com/docker/machine/releases/download/v0.8.2/docker-machine-`uname -s`-`uname -m` >/usr/local/bin/docker-machine
30+
$ chmod +x /usr/local/bin/docker-machine
31+
```
32+
33+
Quickly check the installation of Docker Machine with the following command:
34+
35+
```
36+
$ docker-machine –v
37+
```
38+
39+
Add [the Docker Machine driver from Dimension Data](https://github.com/DimensionDataResearch/docker-machine-driver-ddcloud/releases) and place the executable in the same directory as `docker-machine` executable (or somewhere on your `PATH`).
40+
41+
Set your MCP credentials in the environment, and the initial password for hosts as well.
42+
43+
On Mac and Linux:
44+
45+
```
46+
$ nano ~/.bash_profile
47+
```
48+
49+
Insert lines with your secrets:
50+
51+
```
52+
# credentials for Docker Machine driver
53+
export MCP_USER="<your-name>"
54+
export MCP_PASSWORD='<your-password>'
55+
export MCP_SSH_BOOTSTRAP_PASSWORD="<root-password>"
56+
```
57+
58+
Save the file with `Ctrl-O`, confirm, then exit with `Ctrl-X`.
59+
60+
## Select data centers for your containers
61+
62+
Where do you want to deploy containers? The global network of Managed Cloud Platforms is structured in independent regions. And every region has multiple data centers so that you can architect fault-tolerant systems. In most cases you will consider the data centers that are as close as possible from end-users, and limit network latency. Where data placement is important, select a Managed Cloud Platform in a suitable country, or contract with Dimension Data to add one.
63+
64+
After the selection of a Managed Cloud Platform, you prepare a virtual data centre with the CloudControl web console. A virtual data centre consists at least of: a Network Domain, a VLAN, and appropriate firewall rules.
65+
66+
The below is an example configuration sheet that you can adapt to your own needs.
67+
68+
Managed Cloud Platform:
69+
* EU6 (in Frankfurt, Germany)
70+
* in region EU (the nick name for Europe)
71+
72+
Network Domain:
73+
* name: DockerMachineFox
74+
* type: Essentials
75+
76+
VLAN:
77+
* name: DockerMachineNetwork
78+
* subnet: 10.77.88.0/24
79+
80+
Firewall rule to accept Docker traffic:
81+
* name: DockerInbound
82+
* protocol: TCP over IPv4
83+
* from: any host, any port
84+
* to: any host, port 2376
85+
86+
Firewall rule to accept SSH traffic:
87+
* name: SshInbound
88+
* protocol: TCP over IPv4
89+
* from: any host, any port
90+
* to: any host, port 22
91+
92+
Firewall rule to accept HTTP traffic:
93+
* name: HttpInbound
94+
* protocol: TCP over IPv4
95+
* from: any host, any port
96+
* to: any host, port 80
97+
98+
Firewall rule to accept HTTPS traffic:
99+
* name: HttpsInbound
100+
* protocol: TCP over IPv4
101+
* from: any host, any port
102+
* to: any host, port 443
103+
104+
Firewall rule to accept HTTP proxy traffic:
105+
* name: HttpProxyInbound
106+
* protocol: TCP over IPv4
107+
* from: any host, any port
108+
* to: any host, port 8080
109+
110+
If your containers accept other protocols over the internet then you will create additional rules accordingly.
111+
112+
## How to create a host with Docker Machine?
113+
114+
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:
115+
116+
```bash
117+
$ docker-machine create --driver ddcloud \
118+
--ddcloud-region EU \
119+
--ddcloud-datacenter EU6 \
120+
--ddcloud-networkdomain 'DockerMachineFox' \
121+
--ddcloud-vlan 'DockerMachineNetwork' \
122+
--ddcloud-ssh-key ~/.ssh/id_rsa \
123+
mcp-eu6-01
124+
```
125+
126+
You can check the IP address of the new host, and locate security artifacts, with following command.
127+
128+
```bash
129+
$ docker-machine config mcp-eu6-01
130+
```
131+
132+
The output should be similar to this:
133+
134+
```bash
135+
--tlsverify
136+
--tlscacert="/Users/bernard/.docker/machine/certs/ca.pem"
137+
--tlscert="/Users/bernard/.docker/machine/certs/cert.pem"
138+
--tlskey="/Users/bernard/.docker/machine/certs/key.pem"
139+
-H=tcp://168.128.13.169:2376
140+
```
141+
142+
Now that you have one host up and running you can activate it with following command:
143+
144+
```bash
145+
$ eval $(docker-machine env mcp-eu6-01)
146+
```
147+
148+
As an example, let's try running the official Nginx container:
149+
150+
```bash
151+
$ docker run -d -p 8080:80 --name httpserver nginx
152+
```
153+
154+
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.
155+
156+
```
157+
http://168.128.13.169:8080
158+
```
159+
160+
![nginx](nginx.png)
161+
162+
Congratulations! At this stage you have created a host and deployed a container, all from your workstation.
163+
164+
## How to stop, start, or restart a host?
165+
166+
At the Managed Cloud Platform a stopped server costs far less than a running server. Therefore, a good practice is to stop unused
167+
hosts when possible.
168+
169+
```shell
170+
$ docker-machine stop mcp-eu6-01
171+
```
172+
You can start a host when you want using the following command.
173+
174+
```shell
175+
$ docker-machine start mcp-eu6-01
176+
```
177+
178+
If for some reason you have to restart a host, use the following command.
179+
180+
```shell
181+
$ docker-machine restart mcp-eu6-01
182+
```
25183

26184
## How to handle multiple hosts?
27185

28-
* docker-machine ls
29-
* defining current host
186+
Since it is so easy to create remote hosts with Docker Machine, you can quickly end up with several hosts.
187+
The list of hosts is shown with following command.
188+
189+
```shell
190+
$ docker-machine ls
191+
```
192+
193+
The output should be similar to this:
194+
195+
```
196+
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
197+
mcp-eu6-01 * ddcloud Running tcp://168.128.13.168:2376 v1.12.3
198+
mcp-eu6-02 - ddcloud Running tcp://168.128.13.169:2376 v1.12.3
199+
```
200+
201+
In this example, two hosts are available and `mcp-eu6-01` is currently active. This is meaning that all `docker` commands are executed there.
202+
You can switch to another host with a command like this:
203+
204+
```shell
205+
$ eval $(docker-machine env mcp-eu6-02)
206+
```
207+
208+
## How to execute commands on the host?
209+
210+
Hosts created by Docker Machine are running Linux, so you can login directly:
211+
212+
```shell
213+
$ docker-machine ssh mcp-eu6-02
214+
```
215+
216+
Command prompt now reflects the fact that you're logged into the host as root:
217+
218+
```shell
219+
root@mcp-eu6-02:~#
220+
```
221+
222+
Type the combination `Ctrl-D` to exit the SSH session.
223+
224+
Note that you can also run a command remotely for example.
225+
226+
```shell
227+
$ docker-machine ssh mcp-eu6-01 apt-get update
228+
```
229+
230+
Not sure what kernel your remote Docker host is using? Type the following:
231+
232+
```shell
233+
$ docker-machine ssh mcp-eu6-01 uname -r
234+
```
235+
236+
## How to remove a host?
237+
238+
After this command all resources attached to the host will be lost, including permanent storage:
239+
240+
```bash
241+
$ docker-machine rm mcp-eu6-01
242+
```

0 commit comments

Comments
 (0)