dockercraft icon indicating copy to clipboard operation
dockercraft copied to clipboard

Connected to server but it's empty??

Open k2gremlin opened this issue 6 years ago • 7 comments

So I stood up Dockercraft on a Photon OS server and I am able to connect to it with no problem. However, the world is blank. I expected to see at least the container hosting the dockercraft but it is nothing but a blank world.

The only message I am getting in the portainer logs is "tcp client OnError: 111: Connection refused" over and over about 50 times a second or more.

In portainer, I setup the container with port mapping of 25575:25565, volume /var/run/docker.sock:/var/run/docker.sock and tty command -t.

Here is the results of inspecting the container.

[ { "Id": "1d50c48284408c0158f23ae070dc8f1f1f8bf5064c947d47d427fcd3f9b49322", "Created": "2017-12-16T23:06:27.553581001Z", "Path": "/srv/Server/start.sh", "Args": [], "State": { "Status": "running", "Running": true, "Paused": false, "Restarting": false, "OOMKilled": false, "Dead": false, "Pid": 8037, "ExitCode": 0, "Error": "", "StartedAt": "2017-12-16T23:06:27.757120107Z", "FinishedAt": "0001-01-01T00:00:00Z" }, "Image": "sha256:dad8850a800d96ec7f633a8ef98ec9b39ac60b98eeb25c05079f5e63e6418d88", "ResolvConfPath": "/var/lib/docker/containers/1d50c48284408c0158f23ae070dc8f1f1f8bf5064c947d47d427fcd3f9b49322/resolv.conf", "HostnamePath": "/var/lib/docker/containers/1d50c48284408c0158f23ae070dc8f1f1f8bf5064c947d47d427fcd3f9b49322/hostname", "HostsPath": "/var/lib/docker/containers/1d50c48284408c0158f23ae070dc8f1f1f8bf5064c947d47d427fcd3f9b49322/hosts", "LogPath": "/var/lib/docker/containers/1d50c48284408c0158f23ae070dc8f1f1f8bf5064c947d47d427fcd3f9b49322/1d50c48284408c0158f23ae070dc8f1f1f8bf5064c947d47d427fcd3f9b49322-json.log", "Name": "/mc", "RestartCount": 0, "Driver": "overlay2", "MountLabel": "", "ProcessLabel": "", "AppArmorProfile": "", "ExecIDs": null, "HostConfig": { "Binds": [ "/var/run/docker.sock:/var/run/docker.sock" ], "ContainerIDFile": "", "LogConfig": { "Type": "json-file", "Config": {} }, "NetworkMode": "bridge", "PortBindings": { "25565/tcp": [ { "HostIp": "", "HostPort": "25575" } ] }, "RestartPolicy": { "Name": "no", "MaximumRetryCount": 0 }, "AutoRemove": false, "VolumeDriver": "", "VolumesFrom": null, "CapAdd": null, "CapDrop": null, "Dns": null, "DnsOptions": null, "DnsSearch": null, "ExtraHosts": [], "GroupAdd": null, "IpcMode": "", "Cgroup": "", "Links": null, "OomScoreAdj": 0, "PidMode": "", "Privileged": false, "PublishAllPorts": false, "ReadonlyRootfs": false, "SecurityOpt": null, "UTSMode": "", "UsernsMode": "", "ShmSize": 67108864, "Runtime": "runc", "ConsoleSize": [ 0, 0 ], "Isolation": "", "CpuShares": 0, "Memory": 0, "NanoCpus": 0, "CgroupParent": "", "BlkioWeight": 0, "BlkioWeightDevice": null, "BlkioDeviceReadBps": null, "BlkioDeviceWriteBps": null, "BlkioDeviceReadIOps": null, "BlkioDeviceWriteIOps": null, "CpuPeriod": 0, "CpuQuota": 0, "CpuRealtimePeriod": 0, "CpuRealtimeRuntime": 0, "CpusetCpus": "", "CpusetMems": "", "Devices": [], "DeviceCgroupRules": null, "DiskQuota": 0, "KernelMemory": 0, "MemoryReservation": 0, "MemorySwap": 0, "MemorySwappiness": -1, "OomKillDisable": false, "PidsLimit": 0, "Ulimits": null, "CpuCount": 0, "CpuPercent": 0, "IOMaximumIOps": 0, "IOMaximumBandwidth": 0 }, "GraphDriver": { "Data": { "LowerDir": "/var/lib/docker/overlay2/577ca66cce3e66d05242bded12a6b28dc73fe4e10a4714ccba21f2d853d570a8-init/diff:/var/lib/docker/overlay2/3787f6b8fabd22ffa287714fe2fb72f402720eb52b1d03e01ce64b849add7c77/diff:/var/lib/docker/overlay2/e2abe38bab171f241b0d8a22323b95cacd98100483ad54bd4b2f8a2817377080/diff:/var/lib/docker/overlay2/3a2c3a4cdf9c0e558941a1310e6aa2ef6d1d001e221da1b95118966f904d8a09/diff:/var/lib/docker/overlay2/5fdad9f1883c13f70a79b712e1845946a6e04d290450180682ef7911b58b18c5/diff:/var/lib/docker/overlay2/0c8320dc2e616060e58616df2c2316e7fdfd5634f3c12f125e89aa155d0cfe23/diff:/var/lib/docker/overlay2/17b0f491af64911cd021dd969099d0c9072a188fe992bc9c9b2480069c497562/diff:/var/lib/docker/overlay2/9622e55000efa3098b7694ad95ccc5b784fb4a02a42436aceeb9332ca9577fcb/diff", "MergedDir": "/var/lib/docker/overlay2/577ca66cce3e66d05242bded12a6b28dc73fe4e10a4714ccba21f2d853d570a8/merged", "UpperDir": "/var/lib/docker/overlay2/577ca66cce3e66d05242bded12a6b28dc73fe4e10a4714ccba21f2d853d570a8/diff", "WorkDir": "/var/lib/docker/overlay2/577ca66cce3e66d05242bded12a6b28dc73fe4e10a4714ccba21f2d853d570a8/work" }, "Name": "overlay2" }, "Mounts": [ { "Type": "bind", "Source": "/var/run/docker.sock", "Destination": "/var/run/docker.sock", "Mode": "", "RW": true, "Propagation": "rprivate" } ], "Config": { "Hostname": "5332b660f2a7", "Domainname": "", "User": "", "AttachStdin": false, "AttachStdout": false, "AttachStderr": false, "ExposedPorts": { "25565/tcp": {} }, "Tty": true, "OpenStdin": false, "StdinOnce": false, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "tty=true" ], "Cmd": [], "ArgsEscaped": true, "Image": "gaetan/dockercraft:latest", "Volumes": { "/var/run/docker.sock": {} }, "WorkingDir": "", "Entrypoint": [ "/srv/Server/start.sh" ], "OnBuild": null, "Labels": {} }, "NetworkSettings": { "Bridge": "", "SandboxID": "8f1cfa1f6cbe9b1b147c5d1aae9c6c67399fa2cb241452f99cbe8469b25ad58b", "HairpinMode": false, "LinkLocalIPv6Address": "", "LinkLocalIPv6PrefixLen": 0, "Ports": { "25565/tcp": [ { "HostIp": "0.0.0.0", "HostPort": "25575" } ] }, "SandboxKey": "/var/run/docker/netns/8f1cfa1f6cbe", "SecondaryIPAddresses": null, "SecondaryIPv6Addresses": null, "EndpointID": "7abd3911bb852325cc2ebd30cdb67526be618914e9037a36672ed44897682381", "Gateway": "172.17.0.1", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "IPAddress": "172.17.0.5", "IPPrefixLen": 16, "IPv6Gateway": "", "MacAddress": "02:42:ac:11:00:05", "Networks": { "bridge": { "IPAMConfig": {}, "Links": null, "Aliases": null, "NetworkID": "d39e6ff4a80b67e36e6e12018bb68cd0130d97d2ae7374f8060a4947cb52351b", "EndpointID": "7abd3911bb852325cc2ebd30cdb67526be618914e9037a36672ed44897682381", "Gateway": "172.17.0.1", "IPAddress": "172.17.0.5", "IPPrefixLen": 16, "IPv6Gateway": "", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "MacAddress": "02:42:ac:11:00:05", "DriverOpts": null } } } } ]

k2gremlin avatar Dec 16 '17 23:12 k2gremlin

Same issue here too.

bynarlogic avatar Mar 05 '18 23:03 bynarlogic

I'm getting this issue as well, and it seems the error is coming from here: https://github.com/docker/dockercraft/blob/master/Docker/tcpclient.lua#L27

So it's trying to connect to something running in the container on port 25566. Running netstat inside of the container yields nothing running under that port, though:

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp6       0      0 :::8080                 :::*                    LISTEN      17/Cuberite
tcp6       0      0 :::25565                :::*                    LISTEN      17/Cuberite

tjhorner avatar Mar 22 '18 22:03 tjhorner

@lolpants' image seems to fix the issue: https://github.com/docker/dockercraft/pull/86

So I guess a temporary fix until their PR gets merged would be to just use the lolpants/dockercraft image.

tjhorner avatar Mar 22 '18 22:03 tjhorner

I can confirm too on latest MacOS (High Sierra currently), running latest Docker CE, that the current master branch does not work but this lolpants image does: https://github.com/docker/dockercraft/pull/86;

I also had this same error though on an older version of Linux (Ubuntu Wily 15.10), and an older version of Docker (the last supported version for the EOL Wily): 1.12.6, and lolpants image did not work. However, I took an older commit from this repo (pre multi-stage dockerfile since this older version of Docker couldn't interpret syntax like "alpine:3.6 AS wget"), for example this commit: git checkout 4c0b567249651634e09cbc3fd1a876fde85d5f70

Then, did a docker build and run, and voila, no more error. Instead just seeing "tcp client OnError: 111: Connection refused" endlessly, it eventually spawned and connected the client with "tcp client connected". Hopefully these instructions help someone else running a legacy version of Linux and Docker ;)

scoobyshi avatar Jun 16 '18 18:06 scoobyshi

I can also confirm that on Arch Linux the current version is not running, but I suspect that the error is in the docker binary choosing function in the go code of /bin/dockercraft in the container, because if a link it to the normal docker binary it is working.

Also the docker binary is 0 bytes long:

$ docker exec -it dockercraft /bin/ls -l /bin/docker-18.05.0-ce 
-rw-r--r-- 1 root root 0 Aug 16 12:55 docker-18.05.0-ce

I use this command on the docker host to fix the problem

$ docker exec -it dockercraft /bin/bash -c "rm /bin/docker-18.05.0-ce; ln -s /bin/docker /bin/docker-18.05.0-ce"

If you just remove the docker-18.05.0-ce binary and execute /bin/cubecraft inside the container it fails:

# rm /bin/docker-18.05.0-ce
# dockercraft
INFO[0000] looking for docker binary named: docker-18.05.0-ce 
INFO[0000] docker binary (version 18.05.0-ce) not found. 
INFO[0000] downloading docker-18.05.0-ce...             
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x70 pc=0x5f5ad2]

goroutine 1 [running]:
compress/gzip.(*Reader).Close(0x0, 0x871d20, 0xc4200105c0)
        /usr/local/go/src/compress/gzip/gunzip.go:292 +0x22
main.extractClient(0xc42000e410, 0xc4202cc090, 0x871d20, 0xc4200105c0)
        /go/src/github.com/docker/dockercraft/setup.go:128 +0x2c6
main.getClient(0xc42000e410, 0xc420018550, 0x4c, 0x72be08, 0x0, 0x0)
        /go/src/github.com/docker/dockercraft/setup.go:115 +0xa9
main.(*Daemon).GetDockerBinary(0xc4202aa190, 0x0, 0x0)
        /go/src/github.com/docker/dockercraft/setup.go:54 +0x46d
main.main()
        /go/src/github.com/docker/dockercraft/main.go:30 +0xcf

So I think it would be a possible fix to rename the docker binary in the Dockerfile or remove the version tag from the docker binary called from the go daemon.

kloenk avatar Aug 16 '18 13:08 kloenk

After some more research, I found that the docker maintainer for Arch Linux is building docker based on a tag from Github. But the current package version (18.05.0-ce) is not built and uploaded to https://download.docker.com/linux/static/stable/x86_64/ and so the dockercraft binary tries to download a version that you need to compile by yourself.

kloenk avatar Aug 16 '18 13:08 kloenk

Same problem here on Arch Linux. I changed the DOCKER_VERSION argument in Dockerfile to 18.09.7 and built the image. The log says docker binary (18.09.7-ce) cannot be found and later gives ton of "tcp client OnError: 111: Connection refused". I suspect that this problem occurs because recent docker builds removed the "-ce" in the filenames.

I made the following modifications to the Dockerfile and it solved the problem for me: between COPY ./Docker /srv/Server/Plugins/Docker and EXPOSE 25565, addRUN ln -s /bin/docker /bin/docker-18.09.7-ce && ln -s /bin/docker /bin/docker-18.09.7. Then build the image and use it.

dedztbh avatar Jul 07 '19 10:07 dedztbh