After reading the specific documentation https://pyarmor.readthedocs.io/en/stable/how-to/register.html#run-unlimited-dockers-in-offline-device, I encountered several problems trying to apply it to my environments (Windows host, WSL & docker desktop, Linux containers).
I read the previous open issues but did not find a working solution.
So, after several attempts, I found a working solution, which I describe below, hoping it will be useful.
Linked issues:
and more...
PyArmor Group on Windows + Docker Desktop (centralized proxy)
This guide explains how to reliably use a PyArmor Group license with Docker Desktop on Windows using the official "Run unlimited dockers in offline device" approach. It describes the initial scenario, the centralized proxy solution implemented in this repo, and the essential operational steps.
Initial scenario
- Windows host with Docker Desktop (Linux containers), registered as an offline PyArmor device (Windows device regfile).
- Requirement: run PyArmor inside a Docker container while reusing the host license.
- Problem: on Docker Desktop,
host.docker.internal is not in the same L3 subnet as containers; PyArmor requires an on-net (same-subnet) auth endpoint for the unlimited-dockers mode.
Adopted solution (in this project)
pyarmor-auth runs on Windows using the Windows device regfile.
- A centralized TCP proxy (socat-based) runs in a shared Docker network
pyarmor-net (172.30.0.0/24) with a fixed IP 172.30.0.10.
- Each application stack attaches to
pyarmor-net and maps host.docker.internal -> 172.30.0.10. This makes the auth endpoint appear on-net and license checks succeed.
Repo components:
- Substack:
pyarmor-proxy/docker-compose.yml (creates pyarmor-net and starts the central proxy at 172.30.0.10)
- Application stacks:
your-app-image, your-app-image2,... (attached to pyarmor-net with extra_hosts pointing to the proxy)
Prerequisites
- PyArmor installed on Windows and a valid Group license (activation/registration files).
- Docker Desktop running on Windows.
- PowerShell (pwsh) recommended as your shell.
Step-by-step
- Start the PyArmor auth server on Windows (using the Windows device regfile):
pyarmor-auth C:\path\to\pyarmor-device-regfile-xxxx.N.zip
# Expected: "listen container auth request on 0.0.0.0:29092"
- Start the centralized proxy (also creates the shared
pyarmor-net if missing):
pyarmor-proxy/docker-compose.yml
FROM alpine:3.19
RUN apk add --no-cache socat
EXPOSE 29092
# Forward local 29092 to Windows host via Docker Desktop mapping
ENTRYPOINT ["socat","-d","-d","TCP-LISTEN:29092,fork,reuseaddr","TCP:host.docker.internal:29092"]
(docker network inspect pyarmor-net >/dev/null 2>&1) || docker network create --subnet=172.30.0.0/24 pyarmor-net
docker compose -f ./pyarmor-proxy/docker-compose.yml up -d --build
- Start an application stack (already configured to use the proxy):
docker compose -f ./your-app-image/docker-compose.yml up -d --build
- Register PyArmor inside the container with the Windows device regfile (if not already done there):
docker cp "C:\path\to\pyarmor-device-regfile-xxxx.N.zip" your-app-image:/
docker exec -it your-app-image bash
pyarmor reg /home/coder/project/pyarmor-device-regfile-xxxx.N.zip
pyarmor -v
- Quick checks
ping -c 1 host.docker.internal
curl -v telnet://host.docker.internal:29092
echo "print('hello world')" > foo.py
pyarmor gen --enable-rft foo.py
How it works (why the proxy is needed)
- On Docker Desktop, the IP behind
host.docker.internal is typically not in the same subnet as containers. PyArmor requires an on-net endpoint for unlimited-dockers.
- The centralized proxy lives in the same Docker network as the app containers (
pyarmor-net) and forwards to host.docker.internal:29092 (routed to Windows by Docker Desktop). PyArmor thus sees a peer in the same network and license verification succeeds.
Minimal example (app service)
Application stacks use a shared external network and map the host to the proxy:
services:
app:
image: your-app-image
extra_hosts:
# Map host.docker.internal to the on-net PyArmor proxy (same-subnet requirement)
- "host.docker.internal:172.30.0.10"
networks:
# Attach pyarmor-net first (primary) so default route matches the host mapping
- pyarmor-net
networks:
pyarmor-net:
external: true
Notes:
- If 172.30.0.0/24 conflicts in your environment, adjust the subnet in
pyarmor-proxy/docker-compose.yml and update extra_hosts in your stacks.
- Ensure
pyarmor-auth is reachable on TCP/29092 (Windows firewall rules).
Troubleshooting
After reading the specific documentation https://pyarmor.readthedocs.io/en/stable/how-to/register.html#run-unlimited-dockers-in-offline-device, I encountered several problems trying to apply it to my environments (Windows host, WSL & docker desktop, Linux containers).
I read the previous open issues but did not find a working solution.
So, after several attempts, I found a working solution, which I describe below, hoping it will be useful.
Linked issues:
this license is not for this machine#2214ERROR: this group device license is not for this machineon Windows but not on Linux #2212ERROR device (4) is not for this machine#2141and more...
PyArmor Group on Windows + Docker Desktop (centralized proxy)
This guide explains how to reliably use a PyArmor Group license with Docker Desktop on Windows using the official "Run unlimited dockers in offline device" approach. It describes the initial scenario, the centralized proxy solution implemented in this repo, and the essential operational steps.
Initial scenario
host.docker.internalis not in the same L3 subnet as containers; PyArmor requires an on-net (same-subnet) auth endpoint for the unlimited-dockers mode.Adopted solution (in this project)
pyarmor-authruns on Windows using the Windows device regfile.pyarmor-net(172.30.0.0/24) with a fixed IP 172.30.0.10.pyarmor-netand mapshost.docker.internal-> 172.30.0.10. This makes the auth endpoint appear on-net and license checks succeed.Repo components:
pyarmor-proxy/docker-compose.yml(createspyarmor-netand starts the central proxy at 172.30.0.10)your-app-image,your-app-image2,... (attached topyarmor-netwithextra_hostspointing to the proxy)Prerequisites
Step-by-step
pyarmor-netif missing):pyarmor-proxy/docker-compose.yml
How it works (why the proxy is needed)
host.docker.internalis typically not in the same subnet as containers. PyArmor requires an on-net endpoint for unlimited-dockers.pyarmor-net) and forwards tohost.docker.internal:29092(routed to Windows by Docker Desktop). PyArmor thus sees a peer in the same network and license verification succeeds.Minimal example (app service)
Application stacks use a shared external network and map the host to the proxy:
Notes:
pyarmor-proxy/docker-compose.ymland updateextra_hostsin your stacks.pyarmor-authis reachable on TCP/29092 (Windows firewall rules).Troubleshooting
"this license is not for this machine" during
gen:ping host.docker.internal,curl -v telnet://host.docker.internal:29092.pyarmor-authuses the Windows device regfile.pyarmor -vshould show a valid Group license for your product."out of license":
Versions: