Had one of my devs report that he was getting a 404 on his local dev environment. It looked like the standard 404 page that Traefik serves if it can't find the service it's supposed to be routing to. Looking in the traefik logs, he had this line:
2025-06-05T16:56:56Z ERR github.com/traefik/traefik/v3/pkg/provider/docker/config.go:82 > error="service \"php-local\" error: port is missing" container=php-local-e202e95115b39285efa98f61a93bdb351455a4a64c6867471805009424b75883 providerName=docker
It was working for me. So I went through his Docker settings and discovered he was running a slightly newer version of Docker Desktop (both of us on Mac M1 Apple Silicon). So I updated my version of Docker and boom, mine broke too. Reverting back solves the issue.
Just wondering if there is anything I could possibly try on the Traefik end to resolve this issue. For reference, the services that are missing are running on ports 8080 and 8443. All my configuration is in docker-compose.yml. Relevant bits below:
services:
traefik:
image: traefik:v3.4
command:
- "--log.level=DEBUG"
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--providers.file.directory=/etc/traefik/dynamic"
- "--providers.file.watch=true"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
ports:
- "8080:8080"
- "80:80"
- "443:443"
php-local:
hostname: php-local.dev
container_name: php-local
expose:
- "8443"
labels:
- "traefik.enable=true"
- "traefik.http.routers.php.rule=Host(`php-local.dev`)"
- "traefik.http.routers.php.entrypoints=websecure"
- "traefik.http.routers.php.tls.domains[0].main=php-local.dev"
You don’t really need the domain (main
), when you already have it in Host()
.
Have you tried setting the port explicitly instead of relying on expose
? From simple Traefik example :
labels:
- traefik.enable=true
- traefik.http.routers.mywhoami.rule=Host(`whoami.example.com`)
- traefik.http.services.mywhoami.loadbalancer.server.port=80
I did try that, but got bad gateway. However, wasn't sure whether I should set it to the incoming port (80 or 443) or the container exposed port (8080 or 8443). I tested with the exposed port and got the Bad Gateway response.
However, looks like there is an actual issue with the new version of docker on mac. I raised the issue there also and had a couple of responses from people with the same problem:
opened 06:16PM - 05 Jun 25 UTC
needs-triage
version/4.42.0
### Description
Had one of my devs report that he was getting a 404 on his loca… l dev environment. It looked like the standard 404 page that Traefik serves if it can't find the service it's supposed to be routing to. Looking in the traefik logs, he had this line:
```
2025-06-05T16:56:56Z ERR github.com/traefik/traefik/v3/pkg/provider/docker/config.go:82 >
error="service \"php-local\" error: port is missing"
container=php-local-e202e95115b39285efa98f61a93bdb351455a4a64c6867471805009424b75883
providerName=docker
```
It was working for me. So I went through his Docker settings and discovered he was running a slightly newer version of Docker Desktop (both of us on Mac M1 Apple Silicon). So I updated my version of Docker and boom, mine broke too. Reverting back solves the issue.
So this affects several different images that were all running fine behind Traefik on v4.41. Images all expose a port. I have also tried adding an `expose: - "8080"` in the docker-compose.yml file, but that hasn't helped. Same error.
Any ideas? Thanks in advance.
Jon
### Reproduce
docker-compose.yml:
```
services:
traefik:
image: traefik:v3.4
command:
- "--log.level=DEBUG"
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--providers.file.directory=/etc/traefik/dynamic"
- "--providers.file.watch=true"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
ports:
- "8080:8080"
- "80:80"
- "443:443"
phpmyadmin:
image: phpmyadmin
expose:
- "8080"
env_file:
- ./secrets/db_secrets.env
labels:
- "traefik.enable=true"
- "traefik.http.routers.phpmyadmin.rule=Host(`mysql.local`)"
- "traefik.http.routers.phpmyadmin.entrypoints=web"
```
`docker-compose up -d`
### Expected behavior
Traefik should find and route traffic to the phpmyadmin container for `mysql.local`
### docker version
```bash
Client:
Version: 28.2.2
API version: 1.50
Go version: go1.24.3
Git commit: e6534b4
Built: Fri May 30 12:07:35 2025
OS/Arch: darwin/arm64
Context: desktop-linux
Server: Docker Desktop 4.42.0 (195023)
Engine:
Version: 28.2.2
API version: 1.50 (minimum version 1.24)
Go version: go1.24.3
Git commit: 45873be
Built: Fri May 30 12:07:27 2025
OS/Arch: linux/arm64
Experimental: false
containerd:
Version: 1.7.27
GitCommit: 05044ec0a9a75232cad458027ca83437aae3f4da
runc:
Version: 1.2.5
GitCommit: v1.2.5-0-g59923ef
docker-init:
Version: 0.19.0
GitCommit: de40ad0
```
### docker info
```bash
Client:
Version: 28.2.2
Context: desktop-linux
Debug Mode: false
Plugins:
ai: Docker AI Agent - Ask Gordon (Docker Inc.)
Version: v1.4.0
Path: /Users/jon/.docker/cli-plugins/docker-ai
buildx: Docker Buildx (Docker Inc.)
Version: v0.24.0-desktop.2
Path: /Users/jon/.docker/cli-plugins/docker-buildx
cloud: Docker Cloud (Docker Inc.)
Version: v0.3.9
Path: /Users/jon/.docker/cli-plugins/docker-cloud
compose: Docker Compose (Docker Inc.)
Version: v2.36.2-desktop.1
Path: /Users/jon/.docker/cli-plugins/docker-compose
debug: Get a shell into any image or container (Docker Inc.)
Version: 0.0.41
Path: /Users/jon/.docker/cli-plugins/docker-debug
desktop: Docker Desktop commands (Docker Inc.)
Version: v0.1.9
Path: /Users/jon/.docker/cli-plugins/docker-desktop
extension: Manages Docker extensions (Docker Inc.)
Version: v0.2.29
Path: /Users/jon/.docker/cli-plugins/docker-extension
init: Creates Docker-related starter files for your project (Docker Inc.)
Version: v1.4.0
Path: /Users/jon/.docker/cli-plugins/docker-init
mcp: Docker MCP Plugin (Docker Inc.)
Version: dev
Path: /Users/jon/.docker/cli-plugins/docker-mcp
model: Docker Model Runner (Docker Inc.)
Version: v0.1.24
Path: /Users/jon/.docker/cli-plugins/docker-model
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
Version: 0.6.0
Path: /Users/jon/.docker/cli-plugins/docker-sbom
scout: Docker Scout (Docker Inc.)
Version: v1.18.1
Path: /Users/jon/.docker/cli-plugins/docker-scout
WARNING: Plugin "/Users/jon/.docker/cli-plugins/docker-dev" is not valid: failed to fetch metadata: fork/exec /Users/jon/.docker/cli-plugins/docker-dev: no such file or directory
Server:
Containers: 8
Running: 7
Paused: 0
Stopped: 1
Images: 19
Server Version: 28.2.2
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
CDI spec directories:
/etc/cdi
/var/run/cdi
Discovered Devices:
cdi: docker.com/gpu=webgpu
Swarm: inactive
Runtimes: runc io.containerd.runc.v2
Default Runtime: runc
Init Binary: docker-init
containerd version: 05044ec0a9a75232cad458027ca83437aae3f4da
runc version: v1.2.5-0-g59923ef
init version: de40ad0
Security Options:
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.10.14-linuxkit
Operating System: Docker Desktop
OSType: linux
Architecture: aarch64
CPUs: 10
Total Memory: 31.29GiB
Name: docker-desktop
ID: 1e3c2eee-82bb-4df3-b319-cdff21608c57
Docker Root Dir: /var/lib/docker
Debug Mode: false
HTTP Proxy: http.docker.internal:3128
HTTPS Proxy: http.docker.internal:3128
No Proxy: hubproxy.docker.internal
Labels:
com.docker.desktop.address=unix:///Users/jon/Library/Containers/com.docker.docker/Data/docker-cli.sock
Experimental: false
Insecure Registries:
hubproxy.docker.internal:5555
::1/128
127.0.0.0/8
Live Restore Enabled: false
WARNING: DOCKER_INSECURE_NO_IPTABLES_RAW is set
```
### Diagnostics ID
1FB09648-C8C1-40C6-98E5-5925CA678508/20250605181251
### Additional Info
_No response_
Further to this, adding the label as mentioned - traefik.http.services.mywhoami.loadbalancer.server.port=80
does clear the error in the logs and all services are now visible in the Traefik dashboard. However, I do still get a Bad Gateway
message if I actually try and visit the site. So it hides the issue from traefik, but doesn't resolve the underlying Docker issue.
.loadbalancer.server.port=80
tells Traefik the port to use inside the container, which the app/process is listening on.
For anyone else seeing an issue, it was indeed a bug in docker, but there is a fix release via the Docker Github Issue link above. Newer versions than 4.42.0 should also contain the fix.
system
Closed
June 12, 2025, 10:31am
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.