You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

Docker Hub镜像不适配ARM/v6树莓派,自制镜像能否用Watchtower更新?

Can Watchtower Update My Locally Built Container (Instead of Using Docker Hub Images)?

Quick Answer

Nope, Watchtower can’t update your locally built container right out of the gate—but I’ll break down why that’s the case, and walk you through two solid ways to fix it.

Why Watchtower Doesn’t Play Nice With Local Builds

Watchtower’s whole schtick is checking remote container registries (like Docker Hub, GHCR, etc.) for newer versions of the image your container is running. When you build an image locally and never push it to a registry:

  • Watchtower has no way to know if a newer version exists—there’s no remote source to compare your local image against
  • Even if you rebuild the image locally with the same tag, Watchtower won’t pick up the change automatically; it needs a registry to signal that an update is available

How to Make Your ARMv6-Compatible Container Watchtower-Updatable

You’ve got two main paths to get Watchtower handling updates for your custom-built image:

Option 1: Run a Private Local Registry (Most Reliable)

This is the cleanest approach, since it mimics how Docker Hub works but keeps everything on your network:

  1. Spin up the official Docker registry container on your Raspberry Pi (or another device on your LAN):
    docker run -d -p 5000:5000 --restart always --name local-registry registry:2
    
  2. After building your image locally, tag it with your registry’s address (replace your-local-image-name with whatever you named your build):
    docker tag your-local-image-name:latest localhost:5000/ttrss-app:latest
    
  3. Push the tagged image to your local registry:
    docker push localhost:5000/ttrss-app:latest
    
  4. Update your Docker Compose file to use this registry image instead of your local build (e.g., image: localhost:5000/ttrss-app:latest)
  5. Configure Watchtower to check your local registry (add --allow-insecure-registry since we’re using HTTP without HTTPS):
    docker run -d \
      --name watchtower \
      --restart always \
      -v /var/run/docker.sock:/var/run/docker.sock \
      containrrr/watchtower \
      --allow-insecure-registry localhost:5000
    

Now, whenever you rebuild your image, re-tag it, and push it to the local registry, Watchtower will detect the new version and update your container automatically.

Option 2: Hack in Local Rebuilds (More Manual)

If you don’t want to run a registry, you can use Watchtower’s lifecycle hooks to trigger a local rebuild—but this is less automated:

  • Write a shell script that pulls the latest changes to your Dockerfile/build context, rebuilds the image, and tags it with the same name your container uses
  • Mount your Dockerfile directory into the Watchtower container, and configure a pre-update hook to run your script
  • Note: Watchtower still won’t automatically know when to trigger this—you’ll either have to run it manually or set up a cron job to rebuild your image on a schedule

This method works, but it’s not as clean as using a registry since you’re bypassing Watchtower’s core update detection logic.

Bonus: Build Multi-Arch Images to Avoid This Hassle Later

To skip this whole problem in the future, you can build a multi-architecture image (including ARMv6) and push it to Docker Hub (or a private registry):

  1. Enable Docker Buildx (it’s included with Docker Desktop, or installable on Linux with docker buildx install)
  2. Build your image with support for multiple architectures:
    docker buildx build --platform linux/arm/v6,linux/amd64 -t your-dockerhub-username/ttrss-app:latest --push .
    
  3. Use this multi-arch image in your Docker Compose file—now Watchtower can update it normally, just like any other Docker Hub image, and it’ll work on your Pi and x86 machines alike.

内容的提问来源于stack exchange,提问作者schklom

火山引擎 最新活动