invalid hostPort: 70000 means the host side of a port mapping in your Compose file is not a usable port number. TCP ports run up to 65535, and the host part must be a number. Change it to a free port in range, such as "127.0.0.1:15900:80".

The message quotes the bad value and nothing else: no file, no service, no line. Search your ports: lists for the text after the colon.

The error

PS> docker compose -f compose.yaml config
invalid hostPort: 70000

The file:

name: fix10-cy-q5
services:
  web:
    image: alpine
    command: ["sleep", "1"]
    ports:
      - "127.0.0.1:70000:80"

A word in the same place gives the same message with that word:

PS> docker compose -f compose.abc.yaml config
invalid hostPort: abc

Why it happens

Both test values sat in the middle of a three-part mapping, "127.0.0.1:70000:80" and "127.0.0.1:abc:80", and each time the message quoted exactly that middle part as the hostPort. A TCP port is a 16-bit number, so 65535 is the highest one; 70000 is above it and abc is not a number at all. Both were refused on config with exit code 1.

An extra digit typed into a port is enough to produce the first case, and a letter in place of a digit the second. The message prints the value exactly as Compose read it, which is the quickest way to spot which mapping is wrong when a service has several.

The fix

name: fix10-cy-q5
services:
  web:
    image: alpine
    command: ["sleep", "1"]
    ports:
      - "127.0.0.1:15900:80"
PS> docker compose -f compose.fixed.yaml config
...
    ports:
      - mode: ingress
        host_ip: 127.0.0.1
        target: 80
        published: "15900"
        protocol: tcp
...

With a host port in range, config prints the mapping in its long form: published: "15900" from the middle part, target: 80 from the last, and host_ip: 127.0.0.1 from the first.

How it was reproduced

Docker Desktop on Windows 11, Docker Compose v5.7.0, engine 29.9.3, Windows PowerShell 5.1. A one-service compose.yaml with "127.0.0.1:70000:80", and a copy with "127.0.0.1:abc:80", gave the two messages above on docker compose -f ... config with exit code 1; with 15900 as the host port the same command printed the model with exit code 0. No container was started and no port was opened. The project name fix10-cy-q5 is the test's own.

Frequently asked

What does invalid hostPort mean in docker compose?
The host side of a ports mapping is not a usable port number. In the test both 70000 and abc gave it; a TCP port is a number no higher than 65535.
What is the highest port number I can map in docker compose?
65535, the highest TCP port. 70000 in the host position was refused with invalid hostPort: 70000.
Why does invalid hostPort not show the file or line?
On Compose v5.7.0 the message printed only the value it could not read. Search the ports lists of your services for that value.

More decoded errors in the Fixes category. A wrong host IP in the same mapping gives invalid IP address, and a valid port that is already taken is covered in port is already allocated.