HTTP端口已公开但未正确响应

时间:2017-07-07 13:12:44

标签: docker docker-machine

在OpenSuse 42.1上运行Docker 1.9.1(此时无法升级,但Docker 1.12上也出现同样问题)。

我有一个Docker镜像,它在端口8080上公开了一个Web应用程序。我可以直接进入容器并从http://localhost:8080/上的容器内正确访问应用程序。

我使用

运行容器
docker run -p 10000:8080 ...

我希望可以通过

访问Web应用程序
http://localhost:10000 or http://public-ip:10000

端口已打开,但连接正在立即关闭。

sudo netstat -nap|grep LISTEN|grep -v LISTENING|grep 1000
root's password:
tcp        0      0 :::10000                :::*                    LISTEN      17375/docker-proxy

我可以telnet到端口10000,但正如所说连接正在立即关闭

docker --version
Docker version 1.9.1, build a34a1d5
docker version
Client:
Version: 1.9.1
API version: 1.21
Go version: go1.4.2
Git commit: a34a1d5
Built: 
OS/Arch: linux/amd64
Server:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   a34a1d5
 Built:        
 OS/Arch:      linux/amd64

docker info (1.9)
Containers: 23
 Running: 1
 Paused: 0
 Stopped: 22
Images: 198
Server Version: 1.12.6
Storage Driver: devicemapper
 Pool Name: docker-8:2-1074640197-pool
 Pool Blocksize: 65.54 kB
 Base Device Size: 10.74 GB
 Backing Filesystem: xfs                                                                                                                                                                                          
 Data file: /dev/loop0                                                                                                                                                                                            
 Metadata file: /dev/loop1                                                                                                                                                                                        
 Data Space Used: 13.22 GB                                                                                                                                                                                        
 Data Space Total: 107.4 GB                                                                                                                                                                                       
 Data Space Available: 94.16 GB                                                                                                                                                                                   
 Metadata Space Used: 20.58 MB                                                                                                                                                                                    
 Metadata Space Total: 2.147 GB                                                                                                                                                                                   
 Metadata Space Available: 2.127 GB                                                                                                                                                                               
 Thin Pool Minimum Free Space: 10.74 GB                                                                                                                                                                           
 Udev Sync Supported: true                                                                                                                                                                                        
 Deferred Removal Enabled: false                                                                                                                                                                                  
 Deferred Deletion Enabled: false
 Deferred Deleted Device Count: 0
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 WARNING: Usage of loopback devices is strongly discouraged for production use. Use `--storage-opt dm.thinpooldev` to specify a custom block storage device.
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.136 (2016-11-05)
Logging Driver: journald
Cgroup Driver: systemd
Plugins:
 Volume: local
 Network: null bridge host overlay
Swarm: inactive
Runtimes: oci runc
Default Runtime: oci
Security Options: seccomp
Kernel Version: 4.11.8-200.fc25.x86_64
Operating System: Fedora 25 (Server Edition)
OSType: linux
Architecture: x86_64
Number of Docker Hooks: 2
CPUs: 6
Total Memory: 29.45 GiB
Name: dev2.zopyx.com
ID: DE7T:KEX4:UCRB:KOED:2DHE:3437:MYDS:LPQT:BBYO:SOQH:2EZL:VTYR
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Insecure Registries:
 127.0.0.0/8
Registries: docker.io (secure)


docker info (1.12)
Containers: 23
 Running: 1
 Paused: 0
 Stopped: 22
Images: 198
Server Version: 1.12.6
Storage Driver: devicemapper
 Pool Name: docker-8:2-1074640197-pool
 Pool Blocksize: 65.54 kB
 Base Device Size: 10.74 GB
 Backing Filesystem: xfs
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 13.22 GB
 Data Space Total: 107.4 GB
 Data Space Available: 94.16 GB
 Metadata Space Used: 20.58 MB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 2.127 GB
 Thin Pool Minimum Free Space: 10.74 GB
 Udev Sync Supported: true
 Deferred Removal Enabled: false
 Deferred Deletion Enabled: false
 Deferred Deleted Device Count: 0
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 WARNING: Usage of loopback devices is strongly discouraged for production use. Use `--storage-opt dm.thinpooldev` to specify a custom block storage device.
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.136 (2016-11-05)
Logging Driver: journald
Cgroup Driver: systemd
Plugins:
 Volume: local
 Network: bridge host overlay null
Swarm: inactive
Runtimes: runc oci
Default Runtime: oci
Security Options: seccomp
Kernel Version: 4.11.8-200.fc25.x86_64
Operating System: Fedora 25 (Server Edition)
OSType: linux
Architecture: x86_64
Number of Docker Hooks: 2
CPUs: 6
Total Memory: 29.45 GiB
Name: dev2.zopyx.com
ID: DE7T:KEX4:UCRB:KOED:2DHE:3437:MYDS:LPQT:BBYO:SOQH:2EZL:VTYR
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Insecure Registries:
 127.0.0.0/8
Registries: docker.io (secure)

这可能是什么问题?

1 个答案:

答案 0 :(得分:0)

解决方案:内部的webservice仅绑定到127.0.0.1而不是0.0.0.0