Cron-Managed Symlink Utility for Chrooted Paths
1.6K
Cron-Managed Symlink Utility for Chrooted Paths.
docker-symlinks is an Alpine-based Docker container that periodically runs the symlinks utility using cron. It optimizes symlinks in your chrooted environment (mounted under /host) by:
This helps maintain a clean and efficient filesystem, especially in environments where symlink management is critical.
# docker-compose.yml
services:
symlinks:
container_name: symlinks
environment:
SCHEDULE: 0 3 * * *
TZ: Europe/Berlin
image: krautsalad/symlinks
restart: unless-stopped
volumes:
- /:/host
- ./empty:/host/var/lib/docker
SCHEDULE: Cron schedule for running the utility (default: 0 0 * * *).TZ: Timezone setting (default: UTC).The container works by copying the statically linked symlinks binary to the host and executing it on the chrooted host. After the utility runs, the copied binary is removed from the host.
The symlinks utility is run with the following options:
-c: Convert absolute symlinks to relative ones.-d: Delete broken or mangled symlinks.-o: Cross filesystems.-r: Recursively process directories.-s: Shorten symlinks.It operates on the chrooted path /host. For correct operation, you must mount your host's root (/) to /host in the container.
To prevent the utility from processing directories you want to exclude (for example, Docker's storage at /var/lib/docker), mount an empty directory over that path. This avoids accidental deletion or modification of essential symlinks.
You can find the full source code on GitHub.
Content type
Image
Digest
sha256:8abd4eed2…
Size
4 MB
Last updated
6 months ago
docker pull krautsalad/symlinks