1
1
# Docker Installation
2
2
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).
6
5
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 ] .
10
8
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 ] .
14
10
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
29
12
30
13
** Step 1.1: Update the apt package index:**
31
14
32
15
``` bash
33
16
$ sudo apt update
34
17
```
35
18
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:**
49
20
50
21
``` bash
51
22
$ sudo apt install \
@@ -55,30 +26,19 @@ $ sudo apt install \
55
26
software-properties-common
56
27
```
57
28
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):**
63
30
64
31
``` bash
65
32
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
66
33
```
67
34
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:**
73
36
74
37
``` bash
75
38
$ sudo apt-key fingerprint 0EBFCD88
76
39
```
77
40
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:**
82
42
83
43
``` bash
84
44
$ sudo add-apt-repository \
@@ -87,7 +47,7 @@ $ sudo add-apt-repository \
87
47
stable"
88
48
```
89
49
90
- ### Install Docker CE from a Known Repository
50
+ ## Install Docker CE from a Known Repository
91
51
92
52
** Step 2.1: Update the apt package index:**
93
53
@@ -103,81 +63,30 @@ $ sudo apt install docker-ce
103
63
104
64
** Step 2.3: Add yourself to the docker group:**
105
65
106
- This is done, so ` sudo ` command will not be needed for docker commands.
107
-
108
66
``` bash
109
67
$ sudo usermod -aG docker $USER
110
68
```
111
69
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
70
** Step 2.4: Verify that Docker CE is installed correctly:**
116
71
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
-
120
72
``` bash
121
73
$ docker run hello-world
122
74
```
123
75
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
163
77
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 .
165
79
166
80
---
167
81
168
82
** Related Guides:**
169
83
170
84
- [ Docker Overview] [ 1 ]
171
- - [ Getting Started with Docker] [ 10 ]
85
+ - [ Getting Started with Docker] [ 4 ]
172
86
173
87
---
174
88
175
89
[ 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