2017-05-03 31 views
3

我一直在關注的docker get started guide頗有淵源 - 除了在我的Python應用程序的幾個變化,我已確認是沒有問題從版本的工作我都推到泊塢窗樞紐。繼上手:堆棧服務器卡住加載頁面不休

然而,當我拿到第3部分,並嘗試加載localhost:80,該頁面只加載不休。

我的命令:

$ docker swarm init 
Swarm initiated: ... 
$ docker stack deploy -c docker-compose.yml 
Creating network getstartedlab_webnet 
Creating service getstartedlab_web 
$ docker stack ps getstartedlab 
ID     NAME     IMAGE      NODE    
    DESIRED STATE  CURRENT STATE   ERROR    PORTS 
fhxqr2u8hxar  getstartedlab_web.1 mctague/friendlyhello:2 cube    Running    Running 29 seconds ago      
4t9mu9r8147e  getstartedlab_web.2 mctague/friendlyhello:2 cube    Running    Running 28 seconds ago      
duute2pvgu9z  getstartedlab_web.3 mctague/friendlyhello:2 cube    Running    Running 30 seconds ago      
9kav6v27qfjn  getstartedlab_web.4 mctague/friendlyhello:2 cube    Running    Running 29 seconds ago      
1s2imbiuk6e2  getstartedlab_web.5 mctague/friendlyhello:2 cube    Running    Running 29 seconds ago      
$ docker logs <one of the running containers> 
* Running on http://0.0.0.0:80/ (Press CTRL+C to quit) 
$ curl localhost:80 
< either an endless loading that I have to cancel with ^C, 
    *OR* Connection refused > 

泊塢窗,compose.yml

version: "3" 
services: 
    web: 
    image: mctague/friendlyhello:2 
    deploy: 
     replicas: 5 
     resources: 
     limits: 
      cpus: "0.1" 
      memory: 50M 
     restart_policy: 
     condition: on-failure 
    ports: 
     - "80:80" 
    networks: 
     - webnet 
networks: 
    webnet: 
+1

你有沒有嘗試過簡單的例子?嘗試只部署1個副本,給它多一點資源並在沒有重啓策略的情況下啓動它(一個可能的錯誤源)。 – Gabbax0r

+0

@ Gabbax0r仍然表現完全一樣,無論是無限加載還是完全不加載 –

+0

您正在運行什麼應用程序?不能確定你有'mctague/friendlyhello'的圖片名稱。你還可以分享你的Dockerfile的內容嗎? – JulioHM

回答

2

在一些系統中,捲曲默認爲本地主機連接IP6。所以,你可以使用運行卷曲:

$ curl 127.0.0.1:80 

$ curl -4 localhost:80 
0

阿列克謝的回答我的問題了。我分辨禁用IPv6的問題(因此默認爲IPv4)的通過添加以下2行(這是在CentOS 7)〜的/etc/sysctl.conf

net.ipv6.conf.all.disable_ipv6 = 1 
net.ipv6.conf.default.disable_ipv6 = 1 

然後執行sysctl -p(所有如根/ SU)。

相關問題