Skip to content

Commit 04f7de6

Browse files
authored
Create setup-docker.md
1 parent 891fc1f commit 04f7de6

1 file changed

Lines changed: 73 additions & 0 deletions

File tree

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Set up Docker and Docker Compose
2+
3+
## Installing Docker
4+
5+
<sub><sup>Reference: [Install Docker Engine on Ubuntu](https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository)</sub></sup>
6+
7+
Set up Docker's `apt` repository.
8+
9+
```bash
10+
# Add Docker's official GPG key:
11+
sudo apt-get update
12+
sudo apt-get install ca-certificates curl
13+
sudo install -m 0755 -d /etc/apt/keyrings
14+
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
15+
sudo chmod a+r /etc/apt/keyrings/docker.asc
16+
17+
# Add the repository to Apt sources:
18+
echo \
19+
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
20+
$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
21+
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
22+
sudo apt-get update
23+
```
24+
25+
Install the Docker packages.
26+
27+
```bash
28+
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
29+
```
30+
31+
Verify that the installation is successful by running the hello-world image:
32+
33+
```bash
34+
sudo docker run hello-world
35+
```
36+
37+
### Now some optional post-installation steps
38+
39+
<sub><sup>Reference: [Linux post-installation steps for Docker Engine](https://docs.docker.com/engine/install/linux-postinstall/)</sub></sup>
40+
41+
Create the `docker` group and add your user:
42+
43+
```bash
44+
sudo groupadd docker
45+
sudo usermod -aG docker $USER
46+
```
47+
48+
Log out and log back in so that your group membership is re-evaluated.
49+
50+
```bash
51+
exit
52+
ssh username@hostname
53+
```
54+
55+
## Installing Docker Compose
56+
57+
<sub><sup>Reference: [Overview of installing Docker Compose](https://docs.docker.com/compose/install/)</sub></sup>
58+
59+
Since we already have Docker Engine and Docker CLI installed, we can install the Docker Compose plugin from the command line, by using Docker's repository:
60+
61+
Update the package index, and install the latest version of Docker Compose:
62+
63+
```bash
64+
sudo apt-get update
65+
sudo apt-get install docker-compose-plugin
66+
```
67+
68+
To verify that Docker Compose is installed correctly we can run:
69+
70+
```bash
71+
docker compose version
72+
```
73+

0 commit comments

Comments
 (0)