lima
lima copied to clipboard
Unable to connect host after restart instance
Description
Environment: MacBook ARM - M1
Steps to reproduce:
- limactl create --name=default template://docker
- Open an editor to review or modify the current configuration
- set arch: "x86_64"
# Review and modify the following configuration for Lima instance "default2".
# - To cancel starting Lima, just save this file as an empty file.
(...)
arch: "x86_64"
# This template requires Lima v0.8.0 or later
images:
# Try to use release-yyyyMMdd image if available. Note that release-yyyyMMdd will be removed after several months.
- location: "https://cloud-images.ubuntu.com/releases/22.04/release-20231211/ubuntu-22.04-server-cloudimg-amd64.img"
arch: "x86_64"
digest: "sha256:6d6af17f28c895d87e29092725370387c5e19efe57e58b96dc574feed4245f89"
- location: "https://cloud-images.ubuntu.com/releases/22.04/release-20231211/ubuntu-22.04-server-cloudimg-arm64.img"
arch: "aarch64"
digest: "sha256:f885a8e8f62ab2c39ab0442ea182b69d49ccd990d24791acb4f1724573d8120f"
# Fallback to the latest release image.
# Hint: run `limactl prune` to invalidate the cache
- location: "https://cloud-images.ubuntu.com/releases/22.04/release/ubuntu-22.04-server-cloudimg-amd64.img"
arch: "x86_64"
- location: "https://cloud-images.ubuntu.com/releases/22.04/release/ubuntu-22.04-server-cloudimg-arm64.img"
arch: "aarch64"
(...)
-
create a docker container in lima instance
-
docker run --name nginx -p 8044:80 -d nginx -
from host:
curl -Ss "http://127.0.0.1:8044" -o /dev/null && echo okreturns ok -
limactl stop default
-
limactl start default
-
lima
-
docker start $(docker ps -a -q)
-
from host:
curl -Ss "http://127.0.0.1:8044" -o /dev/null && echo okreturnscurl: (7) Failed to connect to 127.0.0.1 port 8044 after 3 ms: Couldn't connect to server
Somehow after lima instance restart I cannot connect to docker container again. Right now I need to remove lima instance and set up everything from scratch to make it works - but it is just workaround.
Can you still enter into the instance with limactl shell?
- If not, do you see any error in
~/.lima/default/serial*.logand~/.lima/default/ha.*.log? - If yes, does
docker infowork? Is this just an issue of port forwarding? Islima-guestagentprocess running in the instance?
Don't you need to use --restart, for Docker to start the container again after a reboot ?
https://docs.docker.com/config/containers/start-containers-automatically/
Yes, I can enter into shell.
Yes, docker info works.
This is output for lima-guestagent:
Do not launch manually
Usage:
lima-guestagent [command]
Available Commands:
completion Generate the autocompletion script for the specified shell
daemon run the daemon
help Help about any command
install-systemd install a systemd unit (user)
Flags:
--debug debug mode
-h, --help help for lima-guestagent
-v, --version version for lima-guestagent
Use "lima-guestagent [command] --help" for more information about a command.
@afbjorklund
After stop lima instance all containers are also stopped.
After start lima instance all containers are stopped and I started them by docker start $(docker ps -a -q)
I noticed right now that problem occurred only for instance named default.
When I created an instance named default-problem and enter there by limactl shell default-problem I can stop/start this lima instance, docker containers works fine and curl -Ss "http://127.0.0.1:8044" -o /dev/null && echo ok returns ok from host all the time.
So the problem is only for default instance.
Is this "default-problem" also running in emulation, or is that a native instance (arch: aarch64) ?
@AkihiroSuda @afbjorklund
It turns out that the problem also occurs for names other than default.
When I created a docker container:
docker run \
-d \
-p 3050:3050 \
-e FIREBIRD_DATABASE=db.fdb \
-e FIREBIRD_USER=user \
-e FIREBIRD_PASSWORD=Pass123 \
-e ISC_PASSWORD=Pass123 \
-v db-volume:/firebird \
--name fbd \
jacobalberty/firebird:3.0
and stop lima instance and start then I can't connect to either the firebird database or the nginx. From host curl -Ss "http://127.0.0.1:8044" -o /dev/null && echo ok returns curl: (7) Failed to connect to 127.0.0.1 port 8044 after 3 ms: Couldn't connect to server again.
Maybe there is some with firebird default pot 3050?