Skip to content

[Bug]: port (-p flag) connection reset by peer #1180

@peterpeterparker

Description

@peterpeterparker

I have done the following

  • I have searched the existing issues
  • If possible, I've reproduced the issue using the 'main' branch of this project

Steps to reproduce

Create a Dockerfile:

FROM node:alpine

WORKDIR /app

RUN echo 'const http = require("http"); \
const server = http.createServer((req, res) => { \
  res.writeHead(200, {"Content-Type": "text/plain"}); \
  res.end("Hello world"); \
}); \
server.listen(5866, () => { \
  console.log("Server listening on port 5866"); \
});' > server.js

CMD ["node", "server.js"]

Build:

container build -t port-test .

Run:

container run --rm --name port-test -p 5866:5866 port-test

❌ Test issue:

❯ curl http://localhost:5866
curl: (56) Recv failure: Connection reset by peer
❯ curl http://127.0.01:5866
curl: (56) Recv failure: Connection reset by peer

Note that using port works out, e.g.

❯ container inspect port-test  | jq '.[0].networks[0].ipv4Address'
"192.168.64.10/24"
❯ curl http://192.168.64.10:5866
Hello world%  

Current behavior

Binding port with -p flag when running the container appears to be configured but connections are immediately reset when accessed through localhost or 127.0.0.1.

Direct container IP access works fine though.

Expected behavior

As with Docker or Podman, being able to access a bound port through localhost or 127.0.0.1.

Environment

- OS: macOS 26.2
- Xcode: 26.2

Relevant log output

N/A

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions