1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
|
# Setting up your operating system
In this section, we describe the Docker installation procedure depending
on your host system. We will be focusing on the most popular systems;
for a full list of supported operating systems, please refer to Docker
online documentation: [https://docs.docker.com/](https://docs.docker.com/)
## Linux (Ubuntu / Debian)
At the time of writing, Docker project supports these Ubuntu/Debian
releases:
- Ubuntu Yakkety 16.10
- Ubuntu Xenial 16.04 LTS
- Ubuntu Trusty 14.04 LTS
- Debian 8.0 (64-bit)
- Debian 7.7 (64-bit)
For an updated list of supported distributions, you can refer to the
Docker project website, at these locations:
- [https://docs.docker.com/engine/installation/linux/debian/](https://docs.docker.com/engine/installation/linux/debian/)
- [https://docs.docker.com/engine/installation/linux/ubuntu/](https://docs.docker.com/engine/installation/linux/ubuntu/)
Here are the commands needed to install the Docker engine on your local
host:
```bash
sudo apt-get update
sudo apt-get install wget curl
wget -qO- https://get.docker.com/ | sh
```
This will register a new location in your "sources.list" file and
install the "docker.io" package and its dependencies:
```bash
$ cat /etc/apt/sources.list.d/docker.list
$ deb [arch=amd64] https://apt.dockerproject.org/repo ubuntu-xenial main
$ docker --version
Docker version 17.03.0-ce, build 60ccb22
```
It is then recommended to add your user to the new "docker" system
group:
```bash
sudo usermod -aG docker *<your-login>*
```
... and after that, to log out and log in again to have these credentials
applied.
You can reboot your system or start the Docker daemon using:
```bash
sudo service docker start
```
If everything went right, you should be able to list all locally
available images using:
```bash
$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
```
In our case, no image is available yet, but the environment is ready to
go on.
A SSH client must also be installed:
```bash
sudo apt-get install openssh-client
```
## Windows © (7, 8, 8.1, 10)
**WARNING: although Windows© can work for this purpose, not only are lots
of additional steps needed, but the build process performance itself is
suboptimal. Please consider moving to Linux for a better experience.**
We will be downloading the latest Docker Toolbox at the following
location:
[*https://www.docker.com/docker-toolbox*](https://www.docker.com/docker-toolbox)
and by clicking on the "*Download (Windows)*" button:
![window install windows 1](pictures/docker_install_windows_1.png)\
We will answer "Yes", "Next" and "Install" in the next dialog boxes.
![window install windows 2](pictures/docker_install_windows_2.png){style width:60%;}
![window install windows 3](pictures/docker_install_windows_3.png){style width:48%; float:left; margin-right:0.3em}
![window install windows 4](pictures/docker_install_windows_4.png){style width:48%; float:right}
![window install windows 5](pictures/docker_install_windows_5.png)
We can then start it by double-clicking on the "Docker Quickstart
Terminal" icon:
![window install windows 6](pictures/docker_install_windows_6.png)
It will take a certain amount time to setup everything, until this
banner appears:
![window install windows 7](pictures/docker_install_windows_7.png)
Docker Toolbox provides a 1 Gb RAM/20 Go HDD virtual machine; this is
clearly insufficient for our needs. Let us expand it to 4 Gb RAM/50
HDD (*these are minimal values; feel free to increase them if your computer
has more physical memory and/or free space*) :
```bash
export VBOXPATH=/c/Program\ Files/Oracle/VirtualBox/
export PATH="$PATH:$VBOXPATH"
docker-machine stop default
VBoxManage.exe modifyvm default --memory 4096
VBoxManage.exe createhd --filename build.vmdk --size 51200 --format VMDK
VBoxManage.exe storageattach default --storagectl SATA --port 2 --medium build.vmdk --type hdd
docker-machine start default
docker-machine ssh default "sudo /usr/local/sbin/parted --script /dev/sdb mklabel msdos"
docker-machine ssh default "sudo /usr/local/sbin/parted --script /dev/sdb mkpart primary ext4 1% 99%"
docker-machine ssh default "sudo mkfs.ext4 /dev/sdb1"
docker-machine ssh default "sudo mkdir /tmp/sdb1"
docker-machine ssh default "sudo mount /dev/sdb1 /tmp/sdb1"
docker-machine ssh default "sudo cp -ra /mnt/sda1/* /tmp/sdb1"
docker-machine stop default
VboxManage.exe storageattach default --storagectl SATA --port 2 --medium none
VboxManage.exe storageattach default --storagectl SATA --port 1 --medium build.vmdk --type hdd
docker-machine start default
```
We will then finalize the setup:
```bash
VboxManage.exe modifyvm default --natpf1 sshredir,tcp,127.0.0.1,2222,,2222
docker-machine start default
docker-machine ssh default "echo mkdir /sys/fs/cgroup/systemd | sudo tee /var/lib/boot2docker/bootlocal.sh"
docker-machine restart default
```
A SSH client must also be installed. We will grab *PuTTY* at the
following URL:
[*http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe*](http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe)
## Mac OS X ©
We will be downloading the latest Docker Toolbox at the following
location:
[https://www.docker.com/docker-toolbox](https://www.docker.com/docker-toolbox)
and by clicking on the "*Download (Mac)*" button:
![window install macro 1](pictures/docker_install_macos_1.png)
We will answer "Continue" and "Install" in the next dialog boxes:
![window install macro 2](pictures/docker_install_macos_2.png)
![window install macro 3](pictures/docker_install_macos_3.png){style width:80%;}
![window install macro 4](pictures/docker_install_macos_4.png){style width:80%;}
Then, when we go to our "Applications" folder, we now have a "Docker"
subfolder where we can start "Docker Quickstart Terminal":
![window install macro 5](pictures/docker_install_macos_5.png)
It will take a certain amount of time to setup everything, until this
banner appears:
![window install macro 6](pictures/docker_install_macos_6.png)
Docker Toolbox provides a 1 Gb RAM/20 Go HDD virtual machine; this is
clearly insufficient for our needs. Let us expand it to 4 Gb RAM/50
HDD (*these are minimal values; feel free to increase them if your computer
has more physical memory and/or free space*) :
```bash
docker-machine stop default
VboxManage modifyvm default --memory 4096
VboxManage createhd --filename build.vmdk --size 51200 --format VMDK
VboxManage storageattach default --storagectl SATA --port 2 --medium build.vmdk --type hdd
docker-machine start default
docker-machine ssh default "sudo /usr/local/sbin/parted --script /dev/sdb mklabel msdos"
docker-machine ssh default "sudo /usr/local/sbin/parted --script /dev/sdb mkpart primary ext4 1% 99%"
docker-machine ssh default "sudo mkfs.ext4 /dev/sdb1"
docker-machine ssh default "sudo mkdir /tmp/sdb1"
docker-machine ssh default "sudo mount /dev/sdb1 /tmp/sdb1"
docker-machine ssh default "sudo cp -ra /mnt/sda1/* /tmp/sdb1"
docker-machine stop default
VboxManage storageattach default --storagectl SATA --port 2 --medium none
VboxManage storageattach default --storagectl SATA --port 1 --medium build.vmdk --type hdd
docker-machine start default
```
We will then finalize the setup:
```bash
VboxManage modifyvm default --natpf1 sshredir,tcp,127.0.0.1,2222,,2222
docker-machine ssh default "echo mkdir /sys/fs/cgroup/systemd | sudo tee /var/lib/boot2docker/bootlocal.sh"
docker-machine restart default
```
|