-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
108 additions
and
27 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
layout: post | ||
title: Docker & Docker Compose | ||
title: Docker Desktop & Docker Compose | ||
author: Ralf Eichinger | ||
toc: true | ||
--- | ||
|
@@ -14,54 +14,135 @@ toc: true | |
|
||
It is recommended to install "Docker Desktop". | ||
|
||
## Ubuntu 22.10 | ||
## Ubuntu | ||
|
||
1. Set up Docker’s package repository | ||
1. Add Docker's official GPG key | ||
|
||
```sh | ||
```shell | ||
$ sudo apt-get update | ||
$ sudo apt-get install \ | ||
ca-certificates \ | ||
curl \ | ||
gnupg \ | ||
lsb-release | ||
$ sudo apt-get install ca-certificates curl gnupg | ||
$ sudo install -m 0755 -d /etc/apt/keyrings | ||
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg | ||
$ sudo chmod a+r /etc/apt/keyrings/docker.gpg | ||
``` | ||
|
||
2. Add Docker’s official GPG key | ||
2. Add the repository to Apt sources | ||
|
||
```sh | ||
$ sudo mkdir -p /etc/apt/keyrings | ||
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg | ||
```shell | ||
$ echo \ | ||
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ | ||
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ | ||
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | ||
$ sudo apt-get update | ||
``` | ||
|
||
3. Use the following command to set up the repository | ||
3. Install Docker packages: | ||
|
||
```sh | ||
$ echo \ | ||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ | ||
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | ||
```shell | ||
$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin | ||
``` | ||
|
||
### Docker Engine & Docker Compose | ||
4. Install Docker Desktop: | ||
|
||
Install docker engine | ||
Download latest DEB package from <https://docs.docker.com/desktop/install/ubuntu/>: <https://desktop.docker.com/linux/main/amd64/docker-desktop-4.24.2-amd64.deb?utm_source=docker&utm_medium=webreferral&utm_campaign=docs-driven-download-linux-amd64> | ||
|
||
```sh | ||
$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin | ||
5. Install the package with apt as follows: | ||
|
||
```shell | ||
$ sudo apt-get update | ||
$ sudo apt-get install ~/Downloads/docker-desktop-4.24.2-amd64.deb | ||
``` | ||
|
||
See <https://docs.docker.com/desktop/get-started/>: | ||
|
||
Docker recommends that you authenticate using the Sign in option in the top-right corner of the Docker Dashboard. | ||
Once signed in, you can access your Docker Hub repositories directly from Docker Desktop. | ||
|
||
Install `pass` credentials storage. Docker Desktop relies on pass to store credentials | ||
in gpg2-encrypted files. Before signing in to Docker Hub from the Docker Dashboard or the Docker menu, | ||
you must initialize pass. Docker Desktop displays a warning if you've not initialized pass. | ||
|
||
You can initialize pass by using a gpg key. To generate a gpg key, run: | ||
|
||
```shell | ||
$ gpg --generate-key | ||
gpg (GnuPG) 2.2.40; Copyright (C) 2022 g10 Code GmbH | ||
This is free software: you are free to change and redistribute it. | ||
There is NO WARRANTY, to the extent permitted by law. | ||
|
||
gpg: Verzeichnis `/home/ralf/.gnupg' erzeugt | ||
gpg: Die "Keybox" `/home/ralf/.gnupg/pubring.kbx' wurde erstellt | ||
Hinweis: "gpg --full-generate-key" ruft den erweiterten Dialog auf. | ||
GnuPG erstellt eine User-ID, um Ihren Schlüssel identifizierbar zu machen. | ||
Ihr Name: Hugo Chef | ||
Email-Adresse: [email protected] | ||
Sie haben diese User-ID gewählt: | ||
"Hugo Chef <[email protected]>" | ||
Ändern: (N)ame, (E)-Mail oder (F)ertig/(A)bbrechen? F | ||
Wir müssen eine ganze Menge Zufallswerte erzeugen. Sie können dies | ||
unterstützen, indem Sie z.B. in einem anderen Fenster/Konsole irgendetwas | ||
tippen, die Maus verwenden oder irgendwelche anderen Programme benutzen. | ||
Wir müssen eine ganze Menge Zufallswerte erzeugen. Sie können dies | ||
unterstützen, indem Sie z.B. in einem anderen Fenster/Konsole irgendetwas | ||
tippen, die Maus verwenden oder irgendwelche anderen Programme benutzen. | ||
gpg: /home/ralf/.gnupg/trustdb.gpg: trust-db erzeugt | ||
gpg: Verzeichnis `/home/ralf/.gnupg/openpgp-revocs.d' erzeugt | ||
gpg: Widerrufzertifikat wurde als '/home/ralf/.gnupg/openpgp-revocs.d/4F012AD9D556CE0A2DE10BA273CDB97E0FF73B46.rev' gespeichert. | ||
Öffentlichen und geheimen Schlüssel erzeugt und signiert. | ||
pub rsa3072 2023-10-14 [SC] [verfällt: 2025-10-13] | ||
4F012AD9D556CE0A2DE10BA273CDB97E0FF73B46 | ||
uid Hugo Chef <[email protected]> | ||
sub rsa3072 2023-10-14 [E] [verfällt: 2025-10-13] | ||
``` | ||
To initialize pass, run the following command using the public key generated from the previous command: | ||
```shell | ||
$ pass init 4F012AD9D556CE0A2DE10BA273CDB97E0FF73B46 | ||
mkdir: Verzeichnis '/home/ralf/.password-store/' angelegt | ||
Password store initialized for 4F012AD9D556CE0A2DE10BA273CDB97E0FF73B46 | ||
``` | ||
# Usage | ||
## Docker Desktop | ||
Everytime you need docker/docker compose start the Desktop. | ||
You need to create an account at <https://hub.docker.com> for login. | ||
Start screen: | ||
![Docker Desktop start screen](/home/ralf/DEV/github.com/datazuul/datazuul.github.io/assets/topics/development/docker/docker-desktop-first-start.jpg) | ||
Once you initialize pass, you can sign in on the Docker Dashboard and pull your private images. | ||
When Docker CLI or Docker Desktop use credentials, a user prompt may pop up for the password | ||
you set during the gpg key generation. | ||
Example: | ||
```shell | ||
$ docker pull molly/privateimage | ||
Using default tag: latest | ||
latest: Pulling from molly/privateimage | ||
3b9cc81c3203: Pull complete | ||
Digest: sha256:3c6b73ce467f04d4897d7a7439782721fd28ec9bf62ea2ad9e81a5fb7fb3ff96 | ||
Status: Downloaded newer image for molly/privateimage:latest | ||
docker.io/molly/privateimage:latest | ||
``` | ||
## Docker | ||
Run hello world: | ||
Verify that the Docker Engine installation is successful by running the `hello-world` image: | ||
```sh | ||
$ docker run hello-world | ||
```shell | ||
$ sudo docker run hello-world | ||
Unable to find image 'hello-world:latest' locally | ||
latest: Pulling from library/hello-world | ||
2db29710123e: Pull complete | ||
Digest: sha256:aa0cc8055b82dc2509bed2e19b275c8f463506616377219d9642221ab53cf9fe | ||
719385e32844: Pull complete | ||
Digest: sha256:88ec0acaa3ec199d3b7eaf73588f4518c25f9d34f58ce9a0df68429c5af48e8d | ||
Status: Downloaded newer image for hello-world:latest | ||
Hello from Docker! | ||
|