cirruslabs / cirrus-cli

CLI for executing Cirrus tasks locally and in any CI
GNU Affero General Public License v3.0
201 stars 18 forks source link

`cirrus run` fails trying to open a port on a nonexistent IP #61

Closed jaqx0r closed 4 years ago

jaqx0r commented 4 years ago

Using the cirrus config from github.com/google/mtail/.cirrus.yml and a freshly "go get" cirrus cli:

$ cirrus run
panic: listen tcp 172.17.0.1:0: bind: cannot assign requested address

goroutine 1 [running]:
github.com/cirruslabs/cirrus-cli/internal/executor/rpc.(*RPC).Start(0xc00009e060)
    /home/jaq/go/pkg/mod/github.com/cirruslabs/cirrus-cli@v0.5.0/internal/executor/rpc/rpc.go:119 +0x359
github.com/cirruslabs/cirrus-cli/internal/executor.(*Executor).Run(0xc0001ed2f0, 0xf4e920, 0xc0003d8300, 0x0, 0x0)
    /home/jaq/go/pkg/mod/github.com/cirruslabs/cirrus-cli@v0.5.0/internal/executor/executor.go:82 +0x62
github.com/cirruslabs/cirrus-cli/internal/commands.run(0xc0003ccb00, 0x1582820, 0x0, 0x0, 0x0, 0x0)
    /home/jaq/go/pkg/mod/github.com/cirruslabs/cirrus-cli@v0.5.0/internal/commands/run.go:158 +0x5f5
github.com/spf13/cobra.(*Command).execute(0xc0003ccb00, 0x1582820, 0x0, 0x0, 0xc0003ccb00, 0x1582820)
    /home/jaq/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:842 +0x453
github.com/spf13/cobra.(*Command).ExecuteC(0xc0003cc580, 0xe410d8, 0xc00029b440, 0xc0003dc6a0)
    /home/jaq/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:950 +0x349
github.com/spf13/cobra.(*Command).Execute(...)
    /home/jaq/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:887
github.com/spf13/cobra.(*Command).ExecuteContext(...)
    /home/jaq/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:880
main.main()
    /home/jaq/go/pkg/mod/github.com/cirruslabs/cirrus-cli@v0.5.0/cmd/cirrus/main.go:27 +0x137
$ echo $?
2

I can't figure out why it's trying to bind to this address, it doesn't exist on my machine.

fkorotkov commented 4 years ago

Hey @jaqx0r, do you have docker installed and running? 172.17.0.1 is where Docker daemon is running. @edigaryev CLI should validate that it can connect to Docker and print a pretty error message.

jaqx0r commented 4 years ago

Yes, docker-ce installed on Debian. I verified that dockerd is running.

jaq@gunstar ~/go/src/github.com/google/mtail% service docker status
● docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor
preset>
     Active: active (running) since Sat 2020-09-05 19:43:31 AEST; 24h ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 1657 (dockerd)
      Tasks: 13
     Memory: 95.2M
     CGroup: /system.slice/docker.service
             └─1657 /usr/bin/dockerd -H fd://
--containerd=/run/containerd/cont>

On Sun, 6 Sep 2020, 11:42 Fedor Korotkov, notifications@github.com wrote:

Hey @jaqx0r https://github.com/jaqx0r, do you have docker installed and running? Which OS are you on?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cirruslabs/cirrus-cli/issues/61#issuecomment-687687973, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXFX64FXUFJSR3BL7BDLF3SELVYXANCNFSM4Q3SNTAQ .

edigaryev commented 4 years ago

Do you have any network-related in settings set in the /etc/docker/daemon.json configuration file?

Also, you've mentioned earlier that there's no interface with the 172.17.0.1 address. Could you verify that the docker0 interface actually exists at all? This can be done using ip addr or ifconfig commands.

Looking at the docker network ls output might also give some clues.

jaqx0r commented 4 years ago

The whole daemon.json, which has mode 0644 ,is:

{ "data-root": "/usr/local/docker", "bip": "192.168.9.1/24", "storage-driver": "overlay2" }

There is a docker0 interface with 192.168.9.1/24 assigned.

docker network ls

NETWORK ID NAME DRIVER SCOPE 3e36eb41ccc8 bridge bridge local 130b183197f9 host host local 6fd5026d3f79 none null local

On Sun, 6 Sep 2020 at 20:39, Nikolay Edigaryev notifications@github.com wrote:

Do you have any network-related in settings set in the /etc/docker/daemon.json configuration file?

Also, you've mentioned earlier that there's no interface with the 172.17.0.1 address. Could you verify that the docker0 interface actually exists at all? This can be done using ip addr or ifconfig commands.

Looking at the docker network ls output might also give some clues.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cirruslabs/cirrus-cli/issues/61#issuecomment-687752569, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXFX663VRJFLXBZDUCCF4LSENRE3ANCNFSM4Q3SNTAQ .

edigaryev commented 4 years ago

Sorry, can you also take a look at docker network inspect bridge then?

On Linux, the CLI binds to the IP-address of the docker0 interface, and in case it's named differently — we simply fall back to 172.17.0.1.

jaqx0r commented 4 years ago

$ docker network inspect bridge [ { "Name": "bridge", "Id": "3e36eb41ccc87a47412925caa4ced9b09188f087c1209111a8a06eddef4ce907", "Created": "2020-09-05T19:43:31.088147025+10:00", "Scope": "local", "Driver": "bridge", "EnableIPv6": false, "IPAM": { "Driver": "default", "Options": null, "Config": [ { "Subnet": "192.168.9.0/24", "Gateway": "192.168.9.1" } ] }, "Internal": false, "Attachable": false, "Ingress": false, "ConfigFrom": { "Network": "" }, "ConfigOnly": false, "Containers": {}, "Options": { "com.docker.network.bridge.default_bridge": "true", "com.docker.network.bridge.enable_icc": "true", "com.docker.network.bridge.enable_ip_masquerade": "true", "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0", "com.docker.network.bridge.name": "docker0", "com.docker.network.driver.mtu": "1500" }, "Labels": {} } ]

On Sun, 6 Sep 2020 at 22:03, Nikolay Edigaryev notifications@github.com wrote:

Sorry, can you also take a look at docker network inspect bridge then?

On Linux, the CLI binds to the IP-address of the docker0 interface, and in case it's named differently — we simply fall back to 172.17.0.1.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cirruslabs/cirrus-cli/issues/61#issuecomment-687771091, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXFX64EHUNADEEIER6XF33SEN3APANCNFSM4Q3SNTAQ .

edigaryev commented 4 years ago

Thanks for the additional information! This should be now fixed as a part of #66.

Could you please try out the new 0.6.2 release to see if it works for you?

jaqx0r commented 4 years ago

Awesome, thanks for the quick fix! cirrus run now shows it's spinning up an execution environment!

On Tue, 8 Sep 2020 at 00:37, Nikolay Edigaryev notifications@github.com wrote:

Thanks for the additional information! This should be now fixed as a part of #66 https://github.com/cirruslabs/cirrus-cli/pull/66.

Could you please try out the new 0.6.2 release https://github.com/cirruslabs/cirrus-cli/releases/tag/v0.6.2 to see if it works for you?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cirruslabs/cirrus-cli/issues/61#issuecomment-688366027, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXFX64OEAYQH6BVH3OGDUTSETV25ANCNFSM4Q3SNTAQ .