Docker登录JFrog Artifactory失败:网关超时问题求助
Hey there, let’s figure out why you’re hitting that Gateway Timeout when trying to interact with your Artifactory Docker registries. I’ve run into similar issues with older Artifactory versions and Docker setups, so here’s what to check step by step:
1. Fix the Port Mismatch (Most Likely Culprit)
Docker CLI defaults to using port 80 (HTTP) or 443 (HTTPS) when you don’t specify a port in your registry URL. But your Artifactory is running on port 8082—so when you run docker login docker-virtual.art.local, Docker is trying to reach ports 80/443 instead of 8082, which is why you’re getting a timeout.
Try these fixes:
- Quick test first: Append the Artifactory port to your commands:
If this works, the port mismatch was the issue.docker login docker-virtual.art.local:8082 docker push docker-virtual.art.local:8082/hello-world - Permanent fix (port mapping): Restart your Artifactory container to map port 80 (standard HTTP) to the container’s 8082 port:
(Port 8081 is the REST API port for Artifactory 4.x—keep it mapped if you need API access.)docker run -d -p 80:8082 -p 8081:8081 --name artifactory jfrog-docker-reg2.bintray.io/jfrog/artifactory-oss:4.160.0 - Production-friendly fix (reverse proxy): Set up Nginx/Apache to route traffic from
docker-virtual.art.local(ports 80/443) to Artifactory’s 8082 port. For Artifactory 4.x, make sure the proxy passes theX-Artifactory-Override-Base-Urlheader so Artifactory recognizes the external domain.
2. Ensure Docker Daemon Config is Loaded
You added insecure registries to /etc/default/docker, but systemd-based systems (like Linux Mint) often use /etc/docker/daemon.json instead. Let’s verify:
- Run
docker infoand check theInsecure Registriessection. If your domains aren’t listed, your config didn’t take effect. - Create/edit
/etc/docker/daemon.jsonwith:{ "insecure-registries": [ "docker-virtual.art.local", "docker-dev-local2.art.local", "docker-prod-local2.art.local", "docker-remote.art.local" ] } - Restart Docker to apply changes:
sudo systemctl restart docker - Recheck
docker infoto confirm the insecure registries are now listed.
3. Validate Artifactory’s Docker Repository Setup
Make sure your virtual Docker repository is properly configured in Artifactory 4.160:
- Log into your Artifactory UI at
http://SERVER_HOSTNAME:8082/ui/ - Navigate to Admin > Repositories > Docker and confirm
docker-virtual.art.local(or the matching repository key) exists and is marked as Enabled. - Check the Docker Access Method:
- If you’re using domain access without a port, set this to Reverse Proxy (and configure the proxy as noted earlier).
- If you’re using the port approach, Repository Path should work (just remember to include the port in your Docker commands).
4. Test Basic Network Connectivity
Rule out network issues with a direct curl test from your server:
curl -v http://docker-virtual.art.local:8082/v2/
- If you get a
401 Unauthorizedresponse, that’s good—Artifactory is reachable, and you just need to authenticate correctly. - If this also times out, double-check your
/etc/hostsfile to ensuredocker-virtual.art.localpoints to your Artifactory server’s correct IP (usually127.0.0.1for local setups).
内容的提问来源于stack exchange,提问作者baoquach




