Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
content:serverbasics:docker [2024/08/03 19:54] – [Configuring Docker Daemon] Daniel | content:serverbasics:docker [2025/02/08 11:30] (aktuell) – [Update] Daniel | ||
---|---|---|---|
Zeile 9: | Zeile 9: | ||
__**Warning: | __**Warning: | ||
- | So just: Don't set up Docker | + | So just: Don't set up Docker |
===== Filesystem Layout ===== | ===== Filesystem Layout ===== | ||
- | Mind, that at the time writing, '' | + | Mind, that at the time writing, '' |
- | I personally dislike xfs, especially while its not rubust and won't shrink. I use it anyway, because of its srong advise to do so - with kernel 5.19+ it should be possible to get overlay2 working on btrfs, but still there are things that may not work even with that kernel. | + | I personally dislike xfs, especially while its not rubust and won't shrink. I use it anyway, because of its srong advise to do so - with kernel 5.19+ it should be possible to get overlay2 working on btrfs, but still there are things that may not work even with that kernel |
So make sure, that the Home-Directory of you docker user is on XFS. The ftype is already ok on SuSE 15.5, check output of '' | So make sure, that the Home-Directory of you docker user is on XFS. The ftype is already ok on SuSE 15.5, check output of '' | ||
- | Warning: you may have umask set your way - i prefer 007 as writte | + | Warning: you may have umask set your way - i prefer 007 as written |
That may change the ownership in a way, that even the docker user on the host cannot access the Files, which is OK ! | That may change the ownership in a way, that even the docker user on the host cannot access the Files, which is OK ! | ||
- | __**STRONG WARNING: Don't change permissions or ownership of docker- directories on the Host directly as this will chage them in the container and break your Services !!!**__ | + | __**STRONG WARNING: Don't change permissions or ownership of docker- directories on the Host directly as this will change |
__**The only way to manage Volume- File- Permissions is to bash inside the running container itself and to change them there (to the right values of course)!**__ | __**The only way to manage Volume- File- Permissions is to bash inside the running container itself and to change them there (to the right values of course)!**__ | ||
+ | A short hint: Docker rootless uses Sub(g)uids, which is a feature of Linux. That means each user has a range of userids (quite a huge range) and groupid which the user may use. Those will be exclusive reserved for that user. But it does not mean, that the User can acces the Files created by those Subuids! Also the UIDs are onyl a number - not a real user in Linux having a username- They cannot be used to logon or to work with. Docker manages internally which Host-Subuserid is assigned to which caontainer and to which userid inside the running container/ | ||
===== Packages NOT to install ===== | ===== Packages NOT to install ===== | ||
Zeile 43: | Zeile 43: | ||
===== Docker- User ===== | ===== Docker- User ===== | ||
- | Create a new **group** called **docker** and a new **user** called **docker**. Make the user is in the **default group docker**. | + | Create a new **group** |
Attention: The Home Directory should be on a volume having XFS as btrfs or others are not fully supported right now (20.04.2024 - patches in new Kernel 5.19 are incoming, but this Kernel is not released until now and still there are some problems open in developement there). | Attention: The Home Directory should be on a volume having XFS as btrfs or others are not fully supported right now (20.04.2024 - patches in new Kernel 5.19 are incoming, but this Kernel is not released until now and still there are some problems open in developement there). | ||
- | |||
===== cGroups v2 ===== | ===== cGroups v2 ===== | ||
Zeile 319: | Zeile 318: | ||
'' | '' | ||
- | **by default, the path and the file is not existent, __create it new__ within the docker user**. | + | **by default, the path and the file is not existent, __create it new__ within the docker user**. |
For example, enable IPv6. See [[https:// | For example, enable IPv6. See [[https:// | ||
Zeile 336: | Zeile 335: | ||
</ | </ | ||
- | Notice: Don't use '' | + | Notice: Don't use '' |
Edit: " | Edit: " | ||
Zeile 342: | Zeile 341: | ||
You need to adjust cidr to some unique ULA. ULAs are non internet routable adresses (like 192.X.X.X in ipv4). Select an unique adress only for that internal Docker network - you can choose anything that is not assigned anywhere else on your network to not cause trouble. | You need to adjust cidr to some unique ULA. ULAs are non internet routable adresses (like 192.X.X.X in ipv4). Select an unique adress only for that internal Docker network - you can choose anything that is not assigned anywhere else on your network to not cause trouble. | ||
- | Maybe use this tool to generate: https:// | + | Maybe use this tool to generate: |
===== Networking in Docker rootless ===== | ===== Networking in Docker rootless ===== | ||
- | If you read docs in the net about networking with Docker you may see docker0 as bridge network. While | + | If you read docs in the net about networking with Docker you may see docker0 as bridge network. While this network is also there in docker rootless, you will not find that network as interface on your host like you would on a rootful docker. |
+ | Instead the network is encapsulated in the environement of rootlesskit and not visible to the host. From the Hosts view Docker is just another Application running on your Host talking to the internet like some app would do. | ||
===== Install docker compose ===== | ===== Install docker compose ===== | ||
+ | |||
+ | **This Chapter may be obsolete as since docker v27 the compose plugin is part of installation script - check your output of '' | ||
The command '' | The command '' | ||
Zeile 387: | Zeile 389: | ||
#!/bin/bash | #!/bin/bash | ||
#Upgrade docker rootless and plugin | #Upgrade docker rootless and plugin | ||
+ | ./ | ||
+ | sleep 5 | ||
systemctl --user stop docker | systemctl --user stop docker | ||
+ | sleep 5 | ||
+ | #uninstall | ||
rm -f ~/ | rm -f ~/ | ||
+ | rm ~/ | ||
+ | mv ~/ | ||
+ | #reinstall docker compose | ||
+ | COMPOSE_VER=' | ||
+ | rm $DOCKER_CONFIG/ | ||
+ | echo " | ||
+ | curl -SL https:// | ||
+ | chmod +x $DOCKER_CONFIG/ | ||
+ | #install docker | ||
curl -fsSL https:// | curl -fsSL https:// | ||
#need to give the new binary permissions to acces privileged network ports (beneath 1024) | #need to give the new binary permissions to acces privileged network ports (beneath 1024) | ||
sudo setcap ' | sudo setcap ' | ||
- | + | #this should be everything | |
- | # If you installed docker compose, check the newest version first at https:// | + | docker |
- | curl -SL https:// | + | |
</ | </ | ||
+ | |||
===== Create a place for Yamls ===== | ===== Create a place for Yamls ===== | ||
Zeile 472: | Zeile 487: | ||
Thats all: Docker is running and serving your services, cheers! | Thats all: Docker is running and serving your services, cheers! | ||
+ | |||
+ | ===== Fast Stop of all Containers ===== | ||
+ | |||
+ | This makes life easy '' | ||
+ | < | ||
+ | |||
+ | #!/bin/bash | ||
+ | docker stop $(docker ps -a -q) | ||
+ | docker rm $(docker ps -a -q) | ||
+ | |||
+ | </ | ||