我尝试使用swarm模式启动docker服务,但我无法连接到端口8080
~ $ docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
3tdzofpn6qo5 vigilant_wescoff replicated 0/1 shantanu/abc:latest *:8080->8080/tcp
~ $ docker service ps 3tdzofpn6qo5
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
iki0t3x1oqmz vigilant_wescoff.1 shantanuo/abc:latest ip-172-31-4-142.ap-south-1.compute.internal Ready Ready 1 second ago
z88nyixy7u10 \_ vigilant_wescoff.1 shantanu/abc:latest ip-172-31-4-142.ap-south-1.compute.internal Shutdown Complete 5 minutes ago
zf4fac2a4dlh \_ vigilant_wescoff.1 shantanu/abc:latest ip-172-31-4-142.ap-south-1.compute.internal Shutdown Complete 11 minutes ago
zzqj4lldmxox \_ vigilant_wescoff.1 shantanu/abc:latest ip-172-31-6-134.ap-south-1.compute.internal Shutdown Complete 14 minutes ago
z8eknet7oirq \_ vigilant_wescoff.1 shantanu/abc:latest ip-172-31-20-50.ap-south-1.compute.internal Shutdown Complete 17 minutes ago
我使用docker for aws(社区版)
https://docs.docker.com/docker-for-aws/#docker-community-edition-ce-for-aws
但我想这应该没有任何区别,容器应该可行。我使用docker run命令测试了它,它按预期工作。
如果是群集模式,我怎么知道到底出了什么问题呢?
答案 0 :(得分:1)
docker events
查看协调器正在执行的操作(但您无法查看历史记录)。docker events
来查看容器/网络/卷等正在执行的操作(但您无法查看历史记录)。docker service logs
以查看当前和过去的容器日志docker container inspect
查看该服务任务列表中已停止容器的退出(错误)代码。