Setup docker compose v2 » Historie » Version 6
Jeremias Keihsler, 22.03.2024 11:48
1 | 1 | Jeremias Keihsler | h1. Setup docker compose v2 |
---|---|---|---|
2 | |||
3 | https://goneuland.de/docker-docker-compose-v2-auf-ubuntu-22-04-lts-installieren/ |
||
4 | |||
5 | h2. uninstall old version of docker |
||
6 | |||
7 | <pre><code class="shell"> |
||
8 | for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done |
||
9 | </code></pre> |
||
10 | |||
11 | h2. add docker-repo |
||
12 | |||
13 | h3. remove olkt source-list |
||
14 | |||
15 | <pre><code class="shell"> |
||
16 | sudo rm /etc/apt/sources.list.d/docker.list |
||
17 | </code></pre> |
||
18 | |||
19 | h3. install dependencies |
||
20 | |||
21 | <pre><code class="shell"> |
||
22 | sudo apt update |
||
23 | sudo apt install ca-certificates curl gnupg |
||
24 | </code></pre> |
||
25 | |||
26 | h3. add keys |
||
27 | |||
28 | <pre><code class="shell"> |
||
29 | sudo install -m 0755 -d /etc/apt/keyrings |
||
30 | curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg |
||
31 | sudo chmod a+r /etc/apt/keyrings/docker.gpg |
||
32 | </code></pre> |
||
33 | |||
34 | h3. add repo |
||
35 | |||
36 | <pre><code class="shell"> |
||
37 | echo \ |
||
38 | "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ |
||
39 | "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ |
||
40 | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null |
||
41 | </code></pre> |
||
42 | |||
43 | h2. docker and docker compose install |
||
44 | |||
45 | 4 | Jeremias Keihsler | <pre><code class="shell"> |
46 | 1 | Jeremias Keihsler | sudo apt update |
47 | sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin |
||
48 | </code></pre> |
||
49 | |||
50 | check version: |
||
51 | |||
52 | <pre><code class="shell"> |
||
53 | sudo docker --version && docker compose version |
||
54 | </code></pre> |
||
55 | 5 | Jeremias Keihsler | |
56 | as of 2024-03-19 |
||
57 | |||
58 | <pre> |
||
59 | Docker version 25.0.4, build 1a576c5 |
||
60 | Docker Compose version v2.24.7 |
||
61 | </pre> |
||
62 | 6 | Jeremias Keihsler | |
63 | h2. cheat-sheet |
||
64 | |||
65 | <pre><code class="shell"> |
||
66 | sudo docker compose up -d |
||
67 | sudo docker compose logs |
||
68 | sudo docker compose down |
||
69 | sudo docker ps |
||
70 | sudo docker exec -it b84444ac0cdb /bin/bash |
||
71 | </code></pre> |
||
72 | |||
73 | or more generic ... |
||
74 | |||
75 | <pre><code class="shell"> |
||
76 | sudo docker compose -p pwd -f pwd.yml up -d |
||
77 | sudo docker compose -p pwd -f pwd.yml logs |
||
78 | sudo docker compose -p pwd -f pwd.yml down |
||
79 | sudo docker ps |
||
80 | sudo docker exec -it b84444ac0cdb /bin/bash |
||
81 | </code></pre> |
||
82 | |||
83 | h3. reset everything in the docker instance |
||
84 | |||
85 | <pre><code class="shell"> |
||
86 | sudo docker compose down |
||
87 | sudo docker rm -f $(sudo docker ps -a -q) |
||
88 | sudo docker volume rm $(sudo docker volume ls -q) |
||
89 | sudo docker compose up -d |
||
90 | </code></pre> |