Skip to content

Commit 7efab83

Browse files
committed
Update contents (Docker, Vagrant)
1 parent 89ee303 commit 7efab83

File tree

7 files changed

+527
-124
lines changed

7 files changed

+527
-124
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
# Detailed Docker Installation
2+
3+
The following annotated [Docker][1] installation instructions are based the Docker official
4+
documentation in [Get Docker CE for Ubuntu][2].
5+
6+
For a short version see [Docker Installation][3].
7+
8+
Using the instruction provided here require Linux. You can create and run a Linux VM on a Windows PC
9+
using [Vagrant][4].
10+
11+
A short note about the [Advanced Package Tool][5] (APT) may help understand why the below initial
12+
installation process is lengthy, and why updating the installation later can be done using a single
13+
command.
14+
15+
APT relies on the concept of repositories in order to find software and resolve dependencies. For
16+
APT, a repository is a directory containing packages along with an index file. The Debian project
17+
keeps a central repository of thousands of software packages ready for download and installation.
18+
Any number of additional repositories can be added to APT's `sources.list` configuration file
19+
(`/etc/apt/sources.list`) and then be queried by APT.
20+
21+
## Install Docker on Debian based Linux distributions
22+
23+
Two main steps are required in order to install Docker CE:
24+
25+
- [Update the Known Repositories of APT](#update-the-known-repositories-of-apt)
26+
- [Install Docker CE from a Known Repository](#install-docker-ce-from-a-known-repository)
27+
28+
### Update the Known Repositories of APT
29+
30+
**Step 1.1: Update the apt package index:**
31+
32+
```bash
33+
$ sudo apt update
34+
```
35+
36+
**Step 1.2: Upgrade upgradeable packages:**
37+
38+
This is an optional step. If you are prompted after the previous command that there are packages
39+
that can be upgraded, you may decide to list them and upgrade them using the following commands:
40+
41+
```bash
42+
$ apt list --upgradable
43+
$ sudo apt upgrade
44+
```
45+
46+
**Step 1.3: Install required packages:**
47+
48+
Install packages to allow apt to use a repository over HTTPS.
49+
50+
```bash
51+
$ sudo apt install \
52+
apt-transport-https \
53+
ca-certificates \
54+
curl \
55+
software-properties-common
56+
```
57+
58+
You may be prompt that one or more of he above packages have already the newest versions installed.
59+
60+
**Step 1.4: Add Docker’s official key:**
61+
62+
Add Docker’s official GNU Privacy Guard (GnuPG. Also knows as GPG) key.
63+
64+
```bash
65+
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
66+
```
67+
68+
**Step 1.5: Verify the GPG key:**
69+
70+
Verify that you have now the key with the fingerprint
71+
`9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88`, by searching for the last 8 characters of
72+
the fingerprint.
73+
74+
```bash
75+
$ sudo apt-key fingerprint 0EBFCD88
76+
```
77+
78+
**Step 1.6: Set up the 'stable' repository:**
79+
80+
If you need also 'edge' or 'test' repositories add the word `edge` or `test` (or both) after the
81+
word `stable` in the commands below.
82+
83+
```bash
84+
$ sudo add-apt-repository \
85+
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
86+
$(lsb_release -cs) \
87+
stable"
88+
```
89+
90+
### Install Docker CE from a Known Repository
91+
92+
**Step 2.1: Update the apt package index:**
93+
94+
```bash
95+
$ sudo apt update
96+
```
97+
98+
**Step 2.2: Install the latest version of Docker CE:**
99+
100+
```bash
101+
$ sudo apt install docker-ce
102+
```
103+
104+
**Step 2.3: Add yourself to the docker group:**
105+
106+
This is done, so `sudo` command will not be needed for docker commands.
107+
108+
```bash
109+
$ sudo usermod -aG docker $USER
110+
```
111+
112+
Logging out and logging back in is required, because the group change will not have an effect unless
113+
your session is closed.
114+
115+
**Step 2.4: Verify that Docker CE is installed correctly:**
116+
117+
Verify that Docker CE is installed correctly by running a Docker container from the 'hello-world'
118+
image found on the [Docker Hub][6].
119+
120+
```bash
121+
$ docker run hello-world
122+
```
123+
124+
If all goes well, you are supposed to get something similar to the following message:
125+
126+
```bash
127+
Unable to find image 'hello-world:latest' locally
128+
latest: Pulling from library/hello-world
129+
9bb5a5d4561a: Pull complete
130+
131+
...more text...
132+
133+
Hello from Docker!
134+
This message shows that your installation appears to be working correctly.
135+
```
136+
137+
## Update Docker
138+
139+
If you would like later to update the installed Docker, just repeat the above Steps 2.1 and 2.2.
140+
141+
## Creating Directory Structure for Docker Projects
142+
143+
At some point, before or after installing Docker, you will have to create a directory structure for
144+
Docker projects.
145+
146+
The following structure is an example of such structure on Windows. It is not provided here as the
147+
best structure or as the only possible structure. This is just a possible example that extends the
148+
[example directory structure for Vagrant based projects][7] to include Docker projects:
149+
150+
```
151+
Drive:\ For instance D:\
152+
└──Vagrant\ Main location of the Vagrant Boxes
153+
├──guest_os_name\ The guest OS for all child projects (e.g., xenial)
154+
| ├──.vagrant\ Created automatically on the first launch of vagrant
155+
| ├──some_vagrant_project_name\ Directory for a project using the same guest OS
156+
| ├──another_vagrant_project_name\ Another project directory using the same guest OS
157+
| ├──docker\ Directory for docker projects
158+
| | ├──some_docker_project_name\ Directory for docker project using the same guest OS
159+
| | | ├──project_files
160+
| | | └──Dockerfile
161+
| | └──another_docker_project_name\ Another docker project directory using the same guest OS
162+
| | ├──project_files
163+
| | └──Dockerfile
164+
| └──Vagrantfile Common vagrant config. file for projects in this directory
165+
└──another_guest_os_name\ Optional: Another guest OS for the child projects
166+
```
167+
168+
In the above structure, each docker project has its own [Dockerfile][8].
169+
170+
---
171+
172+
**Related Guides:**
173+
174+
- [Docker Overview][1]
175+
- [Getting Started with Docker][9]
176+
177+
---
178+
[1]: /Guides/Docker/Docker%20Overview
179+
[2]: https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-docker-ce
180+
[3]: /Guides/Docker/Docker%20Installation
181+
[4]: /Guides/Vagrant/Vagrant%20Overview
182+
[5]: https://manpages.debian.org/stretch/apt/apt.8.en.html
183+
[6]: https://hub.docker.com/
184+
[7]: /Guides/Vagrant/Vagrant%20Installation#creating-directory-structure-for-vagrant-boxes
185+
[8]: /Topics/Dockerfile
186+
[9]: /Guides/Docker/Getting%20Started%20with%20Docker

Guides/Docker/Docker Installation.md

+17-108
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,22 @@
11
# Docker Installation
22

3-
The [Docker][1] installation instructions provided here are specific to Linux, either as a native
4-
OS, or hosted as a Virtual Machine (VM).
5-
You can create and run a Linux VM on a Windows PC using [Vagrant][2].
3+
The [Docker][1] installation instructions provided here are specific to Debian based Linux
4+
distributions, such as Ubuntu, either as a native OS, or hosted on a Virtual Machine (VM).
65

7-
Following are detailed steps for installing Community Edition Docker (Docker CE) on Linux using the
8-
recommended approach. This approach and one more approach are described by the Docker official
9-
documentation in [Get Docker CE for Ubuntu][3].
6+
The following steps for installing the Community Edition Docker (Docker CE) on Linux summarize
7+
the recommended approach by the Docker official documentation in [Get Docker CE for Ubuntu][2].
108

11-
A short note about the [Advanced Package Tool][4] (APT) may help understand why the below initial
12-
installation process is lengthy, and why updating the installation later can be done using a single
13-
command.
9+
For annotated instructions with explanations see the [detailed docker installation instructions][3].
1410

15-
APT relies on the concept of repositories in order to find software and resolve dependencies. For
16-
APT, a repository is a directory containing packages along with an index file. The Debian project
17-
keeps a central repository of over 25,000 software packages ready for download and installation. Any
18-
number of additional repositories can be added to APT's `sources.list` configuration file
19-
(`/etc/apt/sources.list`) and then be queried by APT.
20-
21-
## Install Docker
22-
23-
Two main steps are required in order to install Docker CE:
24-
25-
- [Update the Known Repositories of APT](#update-the-known-repositories-of-apt)
26-
- [Install Docker CE from a Known Repository](#install-docker-ce-from-a-known-repository)
27-
28-
### Update the Known Repositories of APT
11+
## Update the Known Repositories of APT
2912

3013
**Step 1.1: Update the apt package index:**
3114

3215
```bash
3316
$ sudo apt update
3417
```
3518

36-
**Step 1.2: Upgrade upgradeable packages:**
37-
38-
This is an optional step. If you are prompted after the previous command that there are packages
39-
that can be upgraded, you may decide to list them and upgrade them using the following commands:
40-
41-
```bash
42-
$ apt list --upgradable
43-
$ sudo apt upgrade
44-
```
45-
46-
**Step 1.3: Install required packages:**
47-
48-
Install packages to allow apt to use a repository over HTTPS.
19+
**Step 1.2: Install required packages:**
4920

5021
```bash
5122
$ sudo apt install \
@@ -55,30 +26,19 @@ $ sudo apt install \
5526
software-properties-common
5627
```
5728

58-
You may be prompt that one or more of he above packages have already the newest versions installed.
59-
60-
**Step 1.4: Add Docker’s official key:**
61-
62-
Add Docker’s official GNU Privacy Guard (GnuPG. Also knows as GPG) key.
29+
**Step 1.3: Add Docker’s official GNU Privacy Guard key (GPG):**
6330

6431
```bash
6532
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
6633
```
6734

68-
**Step 1.5: Verify the GPG key:**
69-
70-
Verify that you have now the key with the fingerprint
71-
`9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88`, by searching for the last 8 characters of
72-
the fingerprint.
35+
**Step 1.4: Verify the GPG key:**
7336

7437
```bash
7538
$ sudo apt-key fingerprint 0EBFCD88
7639
```
7740

78-
**Step 1.6: Set up the 'stable' repository:**
79-
80-
If you need also 'edge' or 'test' repositories add the word `edge` or `test` (or both) after the
81-
word `stable` in the commands below.
41+
**Step 1.5: Set up the 'stable' repository:**
8242

8343
```bash
8444
$ sudo add-apt-repository \
@@ -87,7 +47,7 @@ $ sudo add-apt-repository \
8747
stable"
8848
```
8949

90-
### Install Docker CE from a Known Repository
50+
## Install Docker CE from a Known Repository
9151

9252
**Step 2.1: Update the apt package index:**
9353

@@ -103,81 +63,30 @@ $ sudo apt install docker-ce
10363

10464
**Step 2.3: Add yourself to the docker group:**
10565

106-
This is done, so `sudo` command will not be needed for docker commands.
107-
10866
```bash
10967
$ sudo usermod -aG docker $USER
11068
```
11169

112-
Logging out and logging back in is required, because the group change will not have an effect unless
113-
your session is closed.
114-
11570
**Step 2.4: Verify that Docker CE is installed correctly:**
11671

117-
Verify that Docker CE is installed correctly by running a Docker container from the 'hello-world'
118-
image found on the [Docker Hub][5].
119-
12072
```bash
12173
$ docker run hello-world
12274
```
12375

124-
If all goes well, you are supposed to get something similar to the following message:
125-
126-
```bash
127-
Unable to find image 'hello-world:latest' locally
128-
latest: Pulling from library/hello-world
129-
9bb5a5d4561a: Pull complete
130-
131-
...more text...
132-
133-
Hello from Docker!
134-
This message shows that your installation appears to be working correctly.
135-
```
136-
137-
If you would like later to update Docker, just repeat steps 2.1 and 2.2.
138-
139-
## Creating Directory Structure for Docker Projects
140-
141-
Before or after installing Docker, create a directory structure in Windows for Docker projects.
142-
143-
The following structure extends the [recommended directory structure for the Vagrant Boxes][6] to
144-
include Docker projects:
145-
146-
```
147-
Drive:\ For instance D:\
148-
└──Vagrant\ Main location of the Vagrant Boxes
149-
├──guest_os_name\ The guest OS for all child projects (e.g., xenial)
150-
| ├──.vagrant\ Created automatically on the first launch of vagrant
151-
| ├──some_vagrant_project_name\ Directory for a project using the same guest OS
152-
| ├──another_vagrant_project_name\ Another project directory using the same guest OS
153-
| ├──docker\ Directory for docker projects
154-
| | ├──some_docker_project_name\ Directory for docker project using the same guest OS
155-
| | | ├──project_files
156-
| | | └──Dockerfile
157-
| | └──another_docker_project_name\ Another docker project directory using the same guest OS
158-
| | ├──project_files
159-
| | └──Dockerfile
160-
| └──Vagrantfile Common vagrant config. file for projects in this directory
161-
└──another_guest_os_name\ Optional: Another guest OS for the child projects
162-
```
76+
## Update Docker
16377

164-
In the above structure, each docker project has its own [Dockerfile][7].
78+
If you would like later to update the installed Docker, just repeat the above Steps 2.1 and 2.2.
16579

16680
---
16781

16882
**Related Guides:**
16983

17084
- [Docker Overview][1]
171-
- [Getting Started with Docker][10]
85+
- [Getting Started with Docker][4]
17286

17387
---
17488

17589
[1]: /Guides/Docker/Docker%20Overview
176-
[2]: /Guides/Vagrant/Vagrant%20Overview
177-
[3]: https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-docker-ce
178-
[4]: https://manpages.debian.org/stretch/apt/apt.8.en.html
179-
[5]: https://hub.docker.com/
180-
[6]: /Guides/Vagrant/Vagrant%20Installation#creating-directory-structure-for-vagrant-boxes
181-
[7]: /Topics/Dockerfile
182-
183-
[10]: /Guides/Docker/Getting%20Started%20with%20Docker
90+
[2]: https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-docker-ce
91+
[3]: /Guides/Docker/Detailed%20Docker%20Installation
92+
[4]: /Guides/Docker/Getting%20Started%20with%20Docker

0 commit comments

Comments
 (0)