Docker不会打开端口

时间:2017-05-14 12:22:12

标签: docker

嘿我想将Ark Server作为docker容器运行。

我找到了这个码头图片: https://github.com/TuRz4m/Ark-docker

当我在repo中启动一个容器时,服务器启动,但似乎没有暴露端口。

Docker inspect给出:

[
    {
        "Id": "684ef0ff37194545640e3b627c403d4580a4e1a7c64716cc2d1a41008aa45008",
        "Created": "2017-05-14T12:12:09.596574496Z",
        "Path": "/home/steam/user.sh",
        "Args": [],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 9032,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2017-05-14T12:12:11.167600873Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        },
        "Image": "sha256:d30b0938efb4d95efbeaeb91ce52d2d3fa2098f733ec8b9dfebda42b3432745a",
        "ResolvConfPath": "/var/lib/docker/containers/684ef0ff37194545640e3b627c403d4580a4e1a7c64716cc2d1a41008aa45008/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/684ef0ff37194545640e3b627c403d4580a4e1a7c64716cc2d1a41008aa45008/hostname",
        "HostsPath": "/var/lib/docker/containers/684ef0ff37194545640e3b627c403d4580a4e1a7c64716cc2d1a41008aa45008/hosts",
        "LogPath": "/var/lib/docker/containers/684ef0ff37194545640e3b627c403d4580a4e1a7c64716cc2d1a41008aa45008/684ef0ff37194545640e3b627c403d4580a4e1a7c64716cc2d1a41008aa45008-json.log",
        "Name": "/ark",
        "RestartCount": 0,
        "Driver": "aufs",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": [
            "0da184cd37a00e5969abaa5c49f0b77fa1ef8295b9938f185fa26ed6d047612c"
        ],
        "HostConfig": {
            "Binds": [
                "/opt/steam/servers/ark/:/ark"
            ],
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "default",
            "PortBindings": {
                "27015/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "27015"
                    }
                ],
                "27015/udp": [
                    {
                        "HostIp": "",
                        "HostPort": "27015"
                    }
                ],
                "32330/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "32330"
                    }
                ],
                "7778/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "7778"
                    }
                ],
                "7778/udp": [
                    {
                        "HostIp": "",
                        "HostPort": "7778"
                    }
                ]
            },
            "RestartPolicy": {
                "Name": "no",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "CapAdd": null,
            "CapDrop": null,
            "Dns": [],
            "DnsOptions": [],
            "DnsSearch": [],
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": true,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": [
                "label=disable"
            ],
            "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": [],
            "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": {
            "Name": "aufs",
            "Data": null
        },
        "Mounts": [
            {
                "Type": "bind",
                "Source": "/opt/steam/servers/ark",
                "Destination": "/ark",
                "Mode": "",
                "RW": true,
                "Propagation": ""
            }
        ],
        "Config": {
            "Hostname": "684ef0ff3719",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "27015/tcp": {},
                "27015/udp": {},
                "32330/tcp": {},
                "7778/tcp": {},
                "7778/udp": {}
            },
            "Tty": true,
            "OpenStdin": true,
            "StdinOnce": false,
            "Env": [
                "SESSIONNAME=DomisServer",
                "NBPLAYERS=10",
                "ADMINPASSWORD=mystrongpassword",
                "AUTOUPDATE=120",
                "AUTOBACKUP=60",
                "WARNMINUTE=30",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "SERVERMAP=TheIsland",
                "SERVERPASSWORD=",
                "UPDATEONSTART=1",
                "BACKUPONSTART=1",
                "GIT_TAG=v1.5",
                "SERVERPORT=27015",
                "STEAMPORT=7778",
                "BACKUPONSTOP=0",
                "WARNONSTOP=0",
                "UID=1000",
                "GID=1000"
            ],
            "Cmd": null,
            "ArgsEscaped": true,
            "Image": "turzam/ark",
            "Volumes": {
                "/ark": {}
            },
            "WorkingDir": "/ark",
            "Entrypoint": [
                "/home/steam/user.sh"
            ],
            "OnBuild": null,
            "Labels": {}
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "98f5c4341865e43d1207195af77fa2aaaba3f1c37f5c242a636b0e70bb3090dc",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "27015/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "27015"
                    }
                ],
                "27015/udp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "27015"
                    }
                ],
                "32330/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "32330"
                    }
                ],
                "7778/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "7778"
                    }
                ],
                "7778/udp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "7778"
                    }
                ]
            },
            "SandboxKey": "/var/run/docker/netns/98f5c4341865",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "e73a33f7e11533868645b11539229e258f7cca6faf40465d8ec46926a3af9e7d",
            "Gateway": "172.17.0.1",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "172.17.0.2",
            "IPPrefixLen": 16,
            "IPv6Gateway": "",
            "MacAddress": "02:42:ac:11:00:02",
            "Networks": {
                "bridge": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "abd81240861d34bd2926438800924d151322d133c7498a8e559df4edb28e754d",
                    "EndpointID": "e73a33f7e11533868645b11539229e258f7cca6faf40465d8ec46926a3af9e7d",
                    "Gateway": "172.17.0.1",
                    "IPAddress": "172.17.0.2",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:11:00:02"
                }
            }
        }
    }

nmap 172.17.0.2说:

Starting Nmap 7.40 ( https://nmap.org ) at 2017-05-14 14:20
Nmap scan report for 172.17.0.2
Host is up (0.00019s latency).
All 1000 scanned ports on 172.17.0.2 are closed

Nmap done: 1 IP address (1 host up) scanned in 13.09 seconds

我正在寻找几天的解决方案。但我无法找到与此相关的任何内容。

也许有人可以帮助我。

1 个答案:

答案 0 :(得分:1)

那是因为您使用的是简单的nmap命令nmap <yourContainerIp>,而您的容器正在使用非标准端口。您应该以这种方式在nmap命令上添加要扫描的端口:

nmap <yourContainerIp> -p 27015,32330,7778