lima-vm / lima-vm/lima

Cannot access randomly selected port

Open
#527 2 comments 0 reactions 0 assignees View on GitHub
docker
Dominant language
Go
Stars
21.9k
Forks
957
Avg merge
2d 6h
Merged PRs (30d)
53

Description

When a container is started without host port, it is not accessible via lima.

```sh
$ docker run -d -p 80 nginx:alpine
aece04c330bd262ab2ab6b07bb8f30f41b5ce96aab2339ae743689ae093ccd88
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
aece04c330bd nginx:alpine "/docker-entrypoint.…" Less than a second ago Up 1 second 0.0.0.0:49198->80/tcp, :::49198->80/tcp adoring_meninsky
$ curl localhost:49198
curl: (7) Failed to connect to localhost port 49198: Connection refused
```

It seems even though they are started with a specific host port, when that port was used before, it is still not available.

```sh
$ docker run -d -p 49200:80 nginx:alpine
dbd434293baa57f5c79b6260e2c0b800df90ee9bd46c2cf8ecc6ff1343cf588c
$ curl localhost:49200
curl: (7) Failed to connect to localhost port 49200: Connection refused
$ docker run -d -p 49300:80 nginx:alpine
ce99f09ba568d8d974bdd288fa03bf87797a2b23c32527d37490beb7ecd1ea02
$ curl --head localhost:49300
HTTP/1.1 200 OK
Server: nginx/1.21.5
Date: Thu, 06 Jan 2022 15:05:01 GMT
Content-Type: text/html
Content-Length: 615
Last-Modified: Tue, 28 Dec 2021 18:48:00 GMT
Connection: keep-alive
ETag: "61cb5be0-267"
Accept-Ranges: bytes
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.