Moonglade

Modern Markdown blogging with AI-powered localization and search.

Tag: bash


Say Goodbye to Ugly Tag Suffixes: Building True Multi-Architecture Images with Docker Buildx

This article provides a comprehensive guide to building dual-architecture images for x86 and ARM64 using Docker buildx and QEMU. It begins with the installation of the base environment and the initialization of the builder, explaining how the `binfmt_misc` mechanism enables cross-platform instruction translation, allowing x86 machines to compile ARM code. The core practical section demonstrates how to use the `--platform` parameter to build multi-architecture images in one step, and explains the Manifest List principle: the builder independently compiles images for each architecture and then generates an index, ensuring that clients only download the layers corresponding to their specific architecture upon pull, thereby avoiding redundancy. The article specifically points out that multi-architecture images cannot be directly loaded into the traditional Docker local image list, recommending direct pushing or exporting in OCI format. For CI/CD scenarios, it recommends injecting QEMU support non-invasively by running the `tonistiigi/binfmt` container to keep the environment clean. Additionally, it covers verifying images using `regctl`, testing ARM images on x86 systems, a guide to avoiding common pitfalls regarding Dockerfile architecture compatibility, and an explanation of the purpose of buildx's background BuildKit containers and their resource management. Mastering these techniques enables efficient building and management of enterprise-level multi-architecture automated release pipelines.

Views 359
ARM64 Container Docker Docker Buildx Linux Multi Arch bash

Make Blurry Videos Clear

This article introduces a Linux one-click video super-resolution script based on Real-ESRGAN technology, designed to address the limitations of traditional AI super-resolution tools that only support image processing and have cumbersome video processing workflows. The script automates the entire process, including dependency environment detection and download, video frame extraction, GPU-accelerated AI upscaling, H.265 high-definition encoding, and audio merging, while providing real-time progress bar display. The article provides an in-depth analysis of the core principles of Real-ESRGAN, pointing out that it uses "blind super-resolution" technology. By training on purely synthetic data that simulates complex quality degradations such as multiple blurs, noise, and compression artifacts, it can accurately "infer" high-frequency details lost in the real world, such as hair strands and textures. Users should note the hardware requirements: a discrete graphics card supporting Vulkan is required (NVIDIA RTX series recommended), along with sufficient storage space to handle temporary frame files. The script has been verified on AnduinOS with significant results, making it ideal for restoring old home videos or enhancing the quality of classic low-resolution footage. Users simply need to place the video in the designated directory and run the script to generate a 4x high-definition version.

Views 339
AI Super Resolution Bash Script Linux REAL-ESRGAN Video Upscaling bash

Some quick Docker tips

Common Docker Tips and Tricks The following are some useful Docker commands and techniques that can help you manage your containers and images more effectively. Each section includes explanations of when and how to use these commands. Build an Image from a Dockerfile bash docker ...

Views 615
Container Docker Linux Locale bash timezone

Build your home data center using Docker Swarm Mode!

This article provides a detailed overview of the complete process and core concepts for building a Docker Swarm cluster. First, by configuring hostnames, installing Docker, and initializing the Swarm cluster, it addresses Overlay Network compatibility issues in vSphere environments, successfully establishing a highly available architecture with either one manager and two workers or all managers. Next, it deploys the open-source graphical interface Swarmpit for intuitive cluster state management and provides an in-depth analysis of the hierarchical relationships and interaction logic among Stack, Service, Task, Node, Volume, and Network. The article offers command-line management tips for these core resources, including deployment, monitoring, log viewing, and node maintenance operations. Finally, it demonstrates how to quickly deploy real-world business applications using YAML files, introduces solutions for implementing automated HTTPS with Caddy and building shared storage with GlusterFS, and provides a Systemd service script to ensure nodes automatically come online after a reboot, offering comprehensive and practical guidance for container orchestration in production environments.

Views 716
Cluster Container Docker Docker Swarm Linux Server Swarmpit bash

Deploy a standalone Docker application on the server

This article provides a detailed overview of the complete process and best practices for deploying and managing Docker containers in a virtual machine. First, it guides users on configuring GPG keys to support the Pass password manager and setting up Docker credential storage to enable passwordless login for Docker Desktop. Second, it emphasizes the planning of persistent container volumes, highlighting the importance of mounting host directories to ensure data consistency and sharing. It also provides configuration references for commonly used containers and scripts for running them as non-root users. Additionally, the article explains port mapping, using restart policies to ensure containers start automatically with the host, and safely upgrading containers by deleting and recreating them. For scenarios involving multiple container dependencies, it recommends using Docker Compose to define service networks and volumes, combined with systemd for automated management. Finally, the article summarizes the need to manage the VM and containers separately in hybrid deployments and suggests a gradual transition to a containerized architecture to ensure system stability and maintainability.

Views 413
Container Docker Linux Ubuntu VM bash

Quick Setup - Painless GPG Digital Signatures for All Your Git Commits

This article provides a detailed walkthrough of the complete process for using GPG to digitally sign commits in Git, with the goal of preventing others from forging commit history. It first explains the role of GPG signatures in verifying the authenticity and integrity of documents, and guides users on installing GPG tools based on their operating system. Next, it demonstrates generating a key pair via the command line, retrieving the long-form Key ID, and configuring Git global settings to enable automatic signing. Key steps include exporting the public key and adding it to a GitHub or GitLab account, so that the platform trusts the signature, thereby ensuring that only users holding the private key can generate recognized commits. The article also explores convenient solutions for synchronizing keys across devices, suggesting storing the private key file on cloud storage services such as Nextcloud, and importing and configuring it on new devices with a one-click script. It simultaneously emphasizes the importance of enabling two-factor authentication (2FA) and protecting the private key passphrase to avoid security risks. Finally, it points out that after configuration, the public key should be shared with trusted colleagues or friends, who should also trust the public key. This ensures that GPG signatures truly deliver their security protection value in team collaboration, preventing the signature mechanism from becoming a mere formality.

Views 730
GPG Nextcloud PowerShell SSH Sign bash git


Using ZFS is easy

What is ZFS ZFS is a modern file system with many features. Some of the important features include: 1. Copy on write: When modifying a file, ZFS first copies the data being modified and then performs the modification. This ensures data integrity. 2. Redirect on write: When writin...

Views 498
Dedup Disk File Sysytem Linux Raid ZFS bash