I have done the following
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
Code of Conduct