When docker push Goes to HTTPS: Debugging a containerd Insecure Registry
I was trying to docker push to an HTTP-only internal registry (Harbor), but it kept trying
to connect over HTTPS and failing. The classic asymmetry: pull worked, only push died.
After days of digging, the cause turned out to be surprisingly simple: an unnecessary TLS
option (skip_verify) attached to the HTTP host config.
Instead of writing down only the answer, this post honestly keeps the wrong guesses too. For anyone who lands here searching for the same symptom, the journey may help more than the fix.
Document info
Section titled “Document info”| Item | Value |
|---|---|
| Environment | macOS + Docker Desktop (product version not recorded; original label 29.5.3) |
| Image store | containerd image store (c8d) enabled |
| Registry | Harbor registry.example.invalid:5000 (hostname registry.example.invalid), HTTP only |
| Constraints | Keep containerd, no tunnel, no HTTPS switch, no tool swap → fix docker push itself |
29.5.3 is a Docker Engine version in the official release notes. The original called it a Desktop version, but the Desktop product version, docker version output, and detailed containerd version were not preserved, so the actual combination cannot be established.
Symptom
Section titled “Symptom”Pushing to the HTTP-only Harbor died like this:
failed to do request: Head "https://registry.example.invalid:5000/v2/.../blobs/...":remote error: tls: unexpected messageThe registry is clearly HTTP, yet the client sends an https://... request. Harbor
answers in HTTP, the TLS handshake breaks, and we get tls: unexpected message.
The interesting part was that pull worked fine. Same registry, same config, yet pull
succeeded and only push died. This asymmetry was the key clue, but at first I read it wrong.
The constraints were clear.
- Do not disable the containerd image store (keep c8d).
- Do not work around it with an SSH tunnel or local proxy.
- Do not switch the registry to HTTPS.
- Do not swap to another tool like
nerdctl/ctr/colima. - Fix
docker pushitself.
Timeline of the dig (including wrong guesses)
Section titled “Timeline of the dig (including wrong guesses)”Starting point: “I registered it as insecure, so why HTTPS?”
Section titled “Starting point: “I registered it as insecure, so why HTTPS?””First I confirmed the insecure registry registration with docker info.
Insecure Registries: registry.example.invalid:5000It is clearly registered, yet push goes to https. “It’s registered, why https?” was the starting point of the whole dig.
Wrong guess ①: “push takes the moby path and ignores hosts.toml”
Section titled “Wrong guess ①: “push takes the moby path and ignores hosts.toml””I dug through Moby source to understand the registry path in that Docker Desktop c8d setup. These were the original investigation points; the links pin Moby v28.0.0 for comparison. Neither the revision originally consulted nor the running Engine revision was recorded.
daemon/containerd/resolver.go: c8d usesi.registryHosts, whiledaemon/hosts.goreads the hosts directory throughConfigureHosts.LookupPushEndpointsinregistry/service.go: “HTTPS first, exclude mirrors.” This function alone does not establish the c8d push transport behavior.
From this I concluded “this is structurally unfixable: it’s downgrade or HTTPS only.” → This was wrong. I jumped to a conclusion just by reading the code flow.
Rejected proposals: downgrade / HTTPS / loopback workaround
Section titled “Rejected proposals: downgrade / HTTPS / loopback workaround”Based on that wrong conclusion I proposed a downgrade, an HTTPS switch, and a loopback workaround; all blocked by the constraints. “Not a tunnel, not https, not disabling containerd.”
Turning point: “push works in Rancher Desktop”
Section titled “Turning point: “push works in Rancher Desktop””This was the decisive report. Same containerd, yet push works in Rancher Desktop.
- Analysis: Rancher’s containerd mode uses
nerdctl(native containerd), which honors hosts.toml for push too, as I interpreted it. - At that point, I concluded that Docker Desktop’s
docker push(c8d) path differed.
Here too I suggested a nerdctl/ctr/colima workaround, and was rejected again.
“Fix docker push itself.”
Into the VM: checking the real dockerd config
Section titled “Into the VM: checking the real dockerd config”I went inside Docker Desktop’s backend VM to look at the actual daemon config.
Diagnostic caution: The privileged/
nsentercommand below accesses root privileges in the backend VM. The subsequentstracecan affect daemon performance and include sensitive request contents such as credentials in the trace. Use briefly in an authorized, isolated environment and remove sensitive data before sharing.
# Get a root shell in the backend VMdocker run --privileged --pid=host -it ubuntu nsenter -t 1 -m -u -i -n -p shChecking /run/config/docker/daemon.json, insecure-registries were fine; instead I found
proxies (http/https = http.docker.internal:3128).
Wrong guess ②: “the proxy blocks the push upload”
Section titled “Wrong guess ②: “the proxy blocks the push upload””I suspected the proxy. But:
- Docker Desktop’s proxy setting was Manual with empty HTTP/HTTPS fields = no actual upstream proxy.
scutil --proxywas effectively empty too (only*.local,169.254/16).
→ The proxy was innocent. Another dead end.
Log tracing failed
Section titled “Log tracing failed”I tried to read dockerd logs directly, but fd/1,2 were a pipe (pipe:[2651]) already being
consumed by the log collector, so tail didn’t work. The host-side log files were stale.
The decisive blow: capturing at the syscall level with strace
Section titled “The decisive blow: capturing at the syscall level with strace”I decided to watch what the daemon actually does.
strace -f -tt -e trace=connect,sendto,write -s 300 -p <dockerd_pid>And dockerd printed the reason itself.
host will try HTTPS first since it is configured for HTTP with a TLSconfiguration, consider changing host to HTTPS or removing unused TLS configThis single log line solved everything.
The real cause
Section titled “The real cause”The HTTP host in hosts.toml had skip_verify = true attached.
In this Docker Desktop c8d case, skip_verify (TLS config) on the HTTP host produced the HTTPS-first warning. The comparison containerd v2.0.0 source also tries HTTPS first and installs an HTTP fallback transport for HTTP + explicit TLS config + a port other than 80. I interpreted the behavior at the time as follows:
- push → tries https → Harbor is http →
tls: unexpected message(no fallback) - pull → after https fails, falls back to http → which is why it worked
This case’s push ended with the HTTPS error; I interpreted the successful pull as HTTP fallback. This does not mean every push path lacks HTTP fallback. In the comparison containerd source, fallback depends on error conditions rather than request type. This record does not include the full trace, so the precise conditions behind the pull/push difference cannot be established.
So the culprit was neither a “fallback bug,” nor “the proxy,” nor “moby ignoring hosts.toml.”
It was entirely attaching an unnecessary TLS setting (skip_verify) to an HTTP host.
The diagram below summarizes this case’s observations and interpretation at the time, not guaranteed behavior for other versions, CRI, or ctr paths.
The final fix (one line of config)
Section titled “The final fix (one line of config)”In ~/.docker/certs.d/registry.example.invalid:5000/hosts.toml, I removed skip_verify and cleaned it
up to pure HTTP. This path is a macOS host file. The Docker Desktop Mac FAQ describes copying ~/.docker/certs.d to /etc/docker/certs.d in the Linux VM at startup. However, this record does not preserve the actual handoff of this hosts.toml or the path read by the VM resolver. Copying the file path alone cannot guarantee the same result.
server = "http://registry.example.invalid:5000"
[host."http://registry.example.invalid:5000"] capabilities = ["pull", "resolve", "push"]Restart Docker Desktop → docker push succeeds.
Solved with containerd still on, and no tunnel / HTTPS / tool swap at all.
Failure Classification and Verification Boundaries
Section titled “Failure Classification and Verification Boundaries”The point of this case is not to make an HTTP registry the default for production. It is to separate the fact that the cause was skip_verify from the fact that errors which look like an https attempt can originate at different boundaries. Classifying them in the following order prevents adding an insecure registry setting by habit or disabling TLS verification indiscriminately.
Start with the error message, but conclude at the transport boundary
Section titled “Start with the error message, but conclude at the transport boundary”| Observed signal | Boundary to check first | Meaning in this case | Next check |
|---|---|---|---|
tls: unexpected message | Client-selected scheme ↔ registry endpoint | An HTTP endpoint answered an HTTPS request | Check server, host URL, and unused TLS fields in hosts.toml |
x509: certificate signed by unknown authority | TLS trust | The HTTPS endpoint is correct, but the client does not trust its CA | Check CA distribution, hostname/SAN, and TLS termination location |
connection refused or timeout | Network reachability | The endpoint or path is not open | Check DNS, firewall, Service/LB, and listen port |
unauthorized / denied | Registry authentication and authorization | Transport succeeded; the registry rejected credentials or repository access | Check docker login, repository policy, and robot/user permissions |
ImagePullBackOff | Kubernetes runtime ↔ registry | The node runtime could not fetch the image | Inspect the actual pull error in Pod events, node-runtime registry config, and imagePullSecret |
The order in this table matters. unauthorized is not a TLS problem, and an x509 error is not something to cover up by adding skip_verify. Determining the boundary where the request stopped first keeps the change scope minimal.
A safe resolution standard: distinguish an HTTP exception from a TLS solution
Section titled “A safe resolution standard: distinguish an HTTP exception from a TLS solution”The solution in this article was for a constrained HTTP-only development environment under explicit constraints. In a general production environment, the default is to expose the registry through HTTPS and distribute a CA chain trusted by both the client and Kubernetes node runtime.
- When HTTP-only can be allowed: A constrained development or validation network that is not externally exposed, where the endpoint and network boundary are clear and the exception can be documented.
- When HTTP-only must not be allowed: A shared network, production workload, or registry accessible from the internet or outside the trust boundary. Image layers and credential exchanges can traverse plaintext paths, so do not bypass TLS.
- When
skip_verifyis appropriate: Only for a temporary diagnostic situation where verification of an HTTPS endpoint certificate must be bypassed in a limited way. It was removed from this case’s HTTP-only configuration and should not remain as a long-term substitute for CA trust.
In other words, insecure is not a universal switch that fixes a problem. An HTTP exception, CA trust, registry authentication, and Kubernetes image pulls are responsibilities of different control-plane and data-plane paths.
Success signals to verify after a change
Section titled “Success signals to verify after a change”After changing configuration, do not stop after confirming the registry appears in docker info. Verify the real behavior of the client and runtime separately. The following are checks for reuse; no separate Kubernetes verification result was preserved in this record.
# Client path: confirm authentication plus manifest/layer uploaddocker login registry.example.invalid:5000docker push registry.example.invalid:5000/<project>/<image>:<tag>
# Kubernetes path: confirm that the node runtime can pull the same image via Pod eventskubectl describe pod <pod-name> -n <namespace>The success signals are a docker push completing manifest and layer uploads, and a Kubernetes Pod pulling the image without ImagePullBackOff and reaching Ready. Success on one path does not automatically make the other path healthy. Docker Desktop’s client-resolver configuration and the Kubernetes node-runtime configuration can be managed separately.
Recurrence-prevention checklist
Section titled “Recurrence-prevention checklist”- Record whether the registry’s actual endpoint is HTTP or HTTPS and where TLS terminates.
- For a path requiring pure HTTP as in this case, remove unused TLS fields such as
skip_verify,ca, or a client certificate, and check the actual transport configuration. - Resolve trust problems on an HTTPS host with CA distribution and hostname verification, then remove
skip_verifyafter diagnosis. - Do not treat successful
pullas proof thatpushor a Kubernetes image pull also works. - When the registry endpoint, credential, or Tenant Boundary changes, re-verify Docker-client and Kubernetes-runtime settings independently.
This document covers a client-side containerd resolver case. For the operational path where Kubernetes nodes pull registry images, also review the mirror-inventory and runtime-verification boundaries in Kubeflow GitOps Deployment (Air-gapped on Azure AKS).
Key takeaways
Section titled “Key takeaways”- In this HTTP-only c8d case, removing unused
skip_verifywas the fix. The official containerd v2.0.0 hosts documentation also includes an HTTP host +skip_verifyexample, so this is not a prohibition on TLS fields in every containerd configuration. - When pull works but only push dies over HTTPS, suspect “the HTTP host has TLS config, so it went HTTPS-first” before suspecting a missing fallback.
- In that VM, dockerd stdout/stderr were pipes that I could not read with
tail. The info log observed through syscall tracing withstrace -p <dockerd_pid>ended days of digging. This does not mean every Desktop version exposes logs the same way. - In that setup,
/run/config/docker/daemon.jsonwas an auto-generated file (it was regenerated even if edited directly or givendebug:true). I found the internalhttp.docker.internal:3128proxy, but that observation does not establish proxy-bypass handling for every Desktop version.
Appendix: one-line summary
Section titled “Appendix: one-line summary”- Symptom: HTTP registry, yet
docker pushgoes to HTTPS →tls: unexpected message. - Cause: the HTTP host in
hosts.tomlhadskip_verify(TLS config), so containerd went HTTPS-first. - Fix: remove
skip_verify→ recognized as a pure HTTP host → push succeeds. - Debug key: the line
strace -p <dockerd_pid>printed: “HTTPS first … remove unused TLS config.”