Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker cannot connect to the Docker daemon #7

Closed
vraravam opened this issue Sep 10, 2021 · 8 comments
Closed

Docker cannot connect to the Docker daemon #7

vraravam opened this issue Sep 10, 2021 · 8 comments

Comments

@vraravam
Copy link

vraravam commented Sep 10, 2021

At the outset, let me say I'm really thankful for this awesome contribution!

I have a small issue - and a workaround which I think can benefit others if it gets fixed/incorporated into the core:

  1. I start colima with the command-line invocations (colima start)
  2. use it as normal to build images, etc.
  3. I then shutdown colima (colima stop)
  4. Subsequently, even if I start colima again (colima start), the docker commands don't work.
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

I found out that this is due to the fact that the socket file is still available, and is a broken symlink
Screenshot 2021-09-10 at 7 57 35 PM

If I delete the /var/run/docker.sock - then I am able to restart colima and continue with work:

sudo rm -rf /var/run/docker.sock

Can this issue be fixed? Or is there a better way to solve this problem?

@abiosoft
Copy link
Owner

It is perfectly fine for the docker socket file to be available and be a broken link. In fact, that was the design. It becomes an active link only when Colima is up and running.

Are you sure that Colima started successfully and yet you couldn't use docker? If yes, can you share the outputs of colima start, colima version and colima status commands executed in that order.

Thanks.

@abiosoft
Copy link
Owner

I will actually be closing this issue as what you've described (with regards to the socket) is the expected behaviour.
I will re-open when an issue is ascertained.

@vraravam
Copy link
Author

As mentioned in point 4, the subsequent start of colima still has the error.

ok - I think my usage was the problem:
I have these aliases:

alias start_colima='colima start --cpu 3 --memory 6 --disk 75'
alias stop_colima='colima stop'

My guess: when I use start_colima and it detects a change in the config, then the socket doesn't work anymore. Is this true?

@abiosoft
Copy link
Owner

okay, can you kindly share the outputs of these commands? #7 (comment)

@vraravam
Copy link
Author

vraravam commented Sep 10, 2021

; colima start
Linux
● docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2021-09-10 14:53:54 UTC; 52min ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 764 (dockerd)
      Tasks: 16
     Memory: 1.7G
     CGroup: /system.slice/docker.service
             └─764 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Warning: Stopping docker.service, but it can still be activated by:
  docker.socket
time="2021-09-10T21:17:39+05:30" level=info msg="Sending SIGINT to hostagent process 46698"
time="2021-09-10T21:17:39+05:30" level=info msg="Waiting for the host agent and the qemu processes to shut down"
time="2021-09-10T21:17:39+05:30" level=info msg="[hostagent] Received SIGINT, shutting down the host agent"
time="2021-09-10T21:17:39+05:30" level=info msg="[hostagent] Shutting down the host agent"
time="2021-09-10T21:17:39+05:30" level=info msg="[hostagent] Unmounting \"/Users/vijay\""
time="2021-09-10T21:17:39+05:30" level=info msg="[hostagent] Unmounting \"/tmp/colima\""
time="2021-09-10T21:17:39+05:30" level=info msg="[hostagent] Shutting down QEMU with ACPI"
time="2021-09-10T21:17:39+05:30" level=warning msg="[hostagent] connection to the guest agent was closed unexpectedly"
time="2021-09-10T21:17:39+05:30" level=info msg="[hostagent] Sending QMP system_powerdown command"
time="2021-09-10T21:17:49+05:30" level=info msg="[hostagent] Forwarding \"/run/user/501/lima-guestagent.sock\" (guest) to \"/Users/vijay/.lima/colima/ga.sock\" (host)"
time="2021-09-10T21:17:49+05:30" level=warning msg="[hostagent] failed to setting up forward from \"/run/user/501/lima-guestagent.sock\" (guest) to \"/Users/vijay/.lima/colima/ga.sock\" (host)"
time="2021-09-10T21:17:49+05:30" level=warning msg="[hostagent] connection to the guest agent was closed unexpectedly"
time="2021-09-10T21:17:59+05:30" level=info msg="[hostagent] Forwarding \"/run/user/501/lima-guestagent.sock\" (guest) to \"/Users/vijay/.lima/colima/ga.sock\" (host)"
time="2021-09-10T21:17:59+05:30" level=warning msg="[hostagent] failed to setting up forward from \"/run/user/501/lima-guestagent.sock\" (guest) to \"/Users/vijay/.lima/colima/ga.sock\" (host)"
time="2021-09-10T21:18:00+05:30" level=warning msg="[hostagent] connection to the guest agent was closed unexpectedly"
time="2021-09-10T21:18:10+05:30" level=info msg="[hostagent] Forwarding \"/run/user/501/lima-guestagent.sock\" (guest) to \"/Users/vijay/.lima/colima/ga.sock\" (host)"
time="2021-09-10T21:18:10+05:30" level=warning msg="[hostagent] failed to setting up forward from \"/run/user/501/lima-guestagent.sock\" (guest) to \"/Users/vijay/.lima/colima/ga.sock\" (host)"
time="2021-09-10T21:18:10+05:30" level=warning msg="[hostagent] connection to the guest agent was closed unexpectedly"
time="2021-09-10T21:18:15+05:30" level=info msg="[hostagent] QEMU has exited"
; colima stop

I can confirm that just using the plain vanilla colima start and colima stop avoided the issue. And thus, it points to the fact that colima thinking that the config changed is the root cause of this behavior

@abiosoft
Copy link
Owner

Thanks for the sharing the log output.
BTW I am actually not asking for the verbose output :), the standard one is fine.

I am struggling to reproduce your scenario. Are you saying that starting colima with colima start --cpu 3 --memory 6 --disk 75 is causing the issue for you?.

If you wouldn't mind one more time, can you just run this in your terminal and share the output as it is from your terminal. No need to tail the verbose log.

colima stop
colima start --cpu 3 --memory 6 --disk 75
colima version
colima status

@vraravam
Copy link
Author

Screenshot 2021-09-10 at 10 04 45 PM

@abiosoft
Copy link
Owner

That looks perfectly fine.

If you were able to reproduce it again, it would be appreciated if you can update this thread.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants