docker

Back Open Paginator
21.09.2025 01:23
wayubi (@wayubi@mastodon.neometropolis.net)

GPT-OSS optimized.

#!/usr/bin/env bash
# --------------------------------------------------------------
# docker-netlimit.sh
#
# Apply bandwidth limits to specific Docker containers with
# wondershaper. Each entry in LIMITS is:
# "<container_name> <download_kbps> <upload_kbps>"
# --------------------------------------------------------------
set -euo pipefail

# ------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------
LIMITS=(
"container-1 100000 200000"
"container-2 400000 400000"
)

# ------------------------------------------------------------------
# Helper – fetch the container's PID, veth index, and host veth name
# ------------------------------------------------------------------
get_container_info() {
local container=$1
local pid
local ifindex
local veth

pid=$(docker inspect -f '{{.State.Pid}}' "$container" 2>/dev/null || true)
[[ -z $pid || $pid -eq 0 ]] && return 1

ifindex=$(nsenter -t "$pid" -n ip link show eth0 2>/dev/null | \
sed -n 's/.*@if\([0-9]\+\).*/\1/p')
[[ -z $ifindex ]] && return 1

veth=$(ip -o link | awk -v idx=$ifindex '$0 ~ idx {print $2}' | cut -d'@' -f1)
[[ -z $veth ]] && return 1

printf '%s %s %s\n' "$pid" "$ifindex" "$veth"
return 0
}

# ------------------------------------------------------------------
# Main loop
# ------------------------------------------------------------------
for entry in "${LIMITS[@]}"; do
echo $entry
read -r container download upload <<<"$entry"

echo "Processing container: $container (↓ $(($download/1000))Mbps / ↑ $(($upload/1000))Mbps)"

if ! info=$(get_container_info "$container"); then
echo " ❌ Container '$container' not found or not running."
continue
fi

read -r pid ifindex host_veth <<<"$info"
echo " ✅ Container '$container' eth0 → Host veth: $host_veth"

# Clear any existing shaping first
/usr/local/bin/wondershaper -c -a "$host_veth" || true

# Apply the new limits
if /usr/local/bin/wondershaper -a "$host_veth" -d "$download" -u "$upload"; then
echo " ✅ Applied wondershaper to $host_veth"
else
echo " ❌ Failed to apply wondershaper to $host_veth"
fi
done

#docker #linux #bash




Show Original Post


21.09.2025 00:58
wayubi (@wayubi@mastodon.neometropolis.net)

Traffic shaping docker containers, what a pain in the butt, but this works.

#!/bin/bash
# docker-netlimit.sh
# Apply bandwidth limits to specific containers using wondershaper

# =========================
# CONFIGURATION SECTION
# =========================
# Format: "container_name download_kbps upload_kbps"
LIMITS=(
"container-1 100000 200000"
"container-1 400000 400000"
)
# R2Q=10 # rate-to-quantum for HTB to avoid 'quantum too big' warnings

# =========================
# SCRIPT LOGIC
# =========================

for entry in "${LIMITS[@]}"; do
set -- $entry
CONTAINER=$1
DOWNLOAD=$2
UPLOAD=$3

# echo "Processing container: $CONTAINER (↓ ${DOWNLOAD}kbps / ↑ ${UPLOAD}kbps)"
echo "Processing container: $CONTAINER (↓ $(($UPLOAD / 1000))Mbps / ↑ $(($DOWNLOAD / 1000))Mbps)"

# Get the container's PID
PID=$(docker inspect -f '{{.State.Pid}}' "$CONTAINER" 2>/dev/null)
if [ -z "$PID" ] || [ "$PID" = "0" ]; then
echo " ❌ Container '$CONTAINER' not found or not running."
continue
fi

# Get eth0 ifindex from nsenter
CON_IFINDEX=$(nsenter -t "$PID" -n ip link show eth0 2>/dev/null | sed -n 's/.*@if\([0-9]\+\).*/\1/p')
if [ -z "$CON_IFINDEX" ]; then
echo " ❌ Cannot get container eth0 ifindex."
continue
fi

# Find host veth with matching index
HOST_VETH=$(ip -o link | grep "$CON_IFINDEX" | cut -d' ' -f2 | cut -d'@' -f1)
if [ -z "$HOST_VETH" ]; then
echo " ❌ Host veth not found."
continue
fi

echo " ✅ Container '$CONTAINER' eth0 → Host veth: $HOST_VETH"

# Clear existing qdisc
# tc qdisc del dev "$HOST_VETH" root 2>/dev/null

# Add root HTB with r2q
# tc qdisc add dev "$HOST_VETH" root handle 1: htb default 30 r2q "$R2Q"

# Clear any existing shaping first
/usr/local/bin/wondershaper -c -a "$HOST_VETH"

# Apply wondershaper
/usr/local/bin/wondershaper -a "$HOST_VETH" -d "$DOWNLOAD" -u "$UPLOAD"
if [ $? -eq 0 ]; then
echo " ✅ Applied wondershaper to $HOST_VETH"
else
echo " ❌ Failed to apply wondershaper to $HOST_VETH"
fi
done

#docker #linux #bash




Show Original Post


20.09.2025 22:45
S0AndS0 (@S0AndS0@mastodon.social)

Yesterday I burned no smoll amount of time fighting with iptables, felt like I was being touched by them skill-issues...

But today, in a stroke of genius, I did a `iptables -t nat -L PREROUTING -vn` and spotted docker filters were intercepting packets before my rules 🤦




Show Original Post


20.09.2025 22:43
resplendent606 (@resplendent606@climatejustice.social)

I got a little distracted from moving and started tinkering with my server. With the recommendation of @petrosophia (Thank you!) I setup Komodo. I am glad I did. It is amazing! I'm sure I'm only scratching the surface with my newbie little docker compose files, but it is so helpful! I transferred each compose file directly into Komodo and it is super organized! I then got Pi-hole setup. Everything is organized wiith Homarr. I'm really happy with how everything is working.

#Komodo #Docker #Pihole #Homarr #selfhosting #selfhost #homelab #server #GNULinux #GNU #Linux





Show Original Post


20.09.2025 20:26
tylerparker (@tylerparker@mastodon.social)


debugging while attentively praising lil' bro's stream 🧙 🤓 😜




Show Original Post


20.09.2025 15:23
2025 (@2025@www.chefblogger.me)

Von Gitea zu Forgejo – Wie man bestehende Git Repo auf ein neues Repository über tragen kann #Docker #forgejo #gitea #yunohost

chefblogger.me/2025/09/20/von-





Show Original Post


20.09.2025 15:00
voltagex (@voltagex@aus.social)

#IPv6 not being enabled by default in #Docker in 2025 is a real pain.




Show Original Post


20.09.2025 14:33
cdalvaro (@cdalvaro@fosstodon.org)

:docker: 🧂 New Salt Releases: 3007.8 and 3006.16 are out! 🎉

Easily test and manage your Salt setups in a clean Docker container:

docker pull ghcr.io/cdalvaro/docker-salt-master:3007.8

🔧 Includes Salt API, production-ready config & more.
📚 Docs & usage examples.
💬 Feedback and PRs are welcome!

github.com/cdalvaro/docker-sal

Built for the community. Maintained with ❤️ by @cdalvaro

#SaltProject #SaltStack #DevOps #Docker #Containers #SaltAPI #Automation #IoT #Puppet




Show Original Post


20.09.2025 14:09
dirk (@dirk@gts.0x7be.net)

@forgejo Updating the #Docker container worked without any issues!




Show Original Post


20.09.2025 11:32
cattail (@cattail@mastodon.cattail.uk)

Where can I publish #Docker images today? Common places used to be Docker Hub and #GitHub Registry, but I'd rather not use either of them now.




Show Original Post


20.09.2025 10:25
hanscees (@hanscees@ieji.de)

using #docker #ollama here with #webui
Just mentioning if you turn on passwords for users you are opening a can of worms #llm




Show Original Post


20.09.2025 09:41
labrafa (@labrafa@mastodon.world)

Tengo publicado en YouTube un tutorial que explica como configurar un cluster #Kafka usando #Docker.
Maneja datos de forma distribuida de manera moderna y eficiente!

youtu.be/_DcZJGNjajE

#Gratis #SiguemeYTeSigo #Followback

Nota: imagen generada con IA generativa.





Show Original Post


1 ...351 352 353 354 355 356 357 358 359 360 361 ...438
UP