Docker Community Forums

Share and learn in the Docker community.

Docker swarm mode keeps restarting a container even with MaxAttempts set as 1

$ docker -v
Docker version 17.04.0-ce, build 4845c56

restart policy is
"RestartPolicy": {
“Condition”: “on-failure”,
“Delay”: 1,
“MaxAttempts”: 1
},

The app has a code error so it crashed up on starting, I would assume the above policy would tell swarm mode to retry once up on failure but from what I see, swarm mode has been retrying over and over none stop

[ec2-user@ip-192-168-118-130 ~]$ sudo docker node ps ip-192-168-117-108.us-west-2.compute.internal |grep 5953a38750657d002c6f9b7b_mvc_360_test1498653931792
yvokgj7gpgsb 5953a38750657d002c6f9b7b_mvc_360_test1498653931792.1 registry.service.docker.swarm:5000/library/5953a38750657d002c6f9b7b_mvc_360_test1498653931792_0.1.0_100001711_1498653586085:latest ip-192-168-117-108.us-west-2.compute.internal Shutdown Failed 12 minutes ago "task: non-zero exit (1)"
jso1gzvwahl8 _ 5953a38750657d002c6f9b7b_mvc_360_test1498653931792.1 registry.service.docker.swarm:5000/library/5953a38750657d002c6f9b7b_mvc_360_test1498653931792_0.1.0_100001711_1498653586085:latest ip-192-168-117-108.us-west-2.compute.internal Shutdown Failed 15 minutes ago “task: non-zero exit (1)”
[ec2-user@ip-192-168-118-130 ~]$ sudo docker node ps ip-192-168-109-98.us-west-2.compute.internal |grep 5953a38750657d002c6f9b7b_mvc_360_test1498653931792
xgn38pq1axry 5953a38750657d002c6f9b7b_mvc_360_test1498653931792.1 registry.service.docker.swarm:5000/library/5953a38750657d002c6f9b7b_mvc_360_test1498653931792_0.1.0_100001711_1498653586085:latest ip-192-168-109-98.us-west-2.compute.internal Running Preparing 4 minutes ago
sic2nhmrmmx4 5953a38750657d002c6f9b7b_mvc_360_test1498653931792.1 registry.service.docker.swarm:5000/library/5953a38750657d002c6f9b7b_mvc_360_test1498653931792_0.1.0_100001711_1498653586085:latest ip-192-168-109-98.us-west-2.compute.internal Shutdown Rejected 4 minutes ago “No such image: registry.servi…”

[ec2-user@ip-192-168-118-130 ~]$ sudo docker inspect p3kicg6vvqxh
[
{
“ID”: “p3kicg6vvqxhy86axzpn5c9we”,
“Version”: {
“Index”: 14990387
},
“CreatedAt”: “2017-06-28T12:39:56.625039483Z”,
“UpdatedAt”: “2017-06-30T20:32:09.327753928Z”,
“Spec”: {
“Name”: “5953a38750657d002c6f9b7b_mvc_360_test1498653931792”,
“Labels”: {},
“TaskTemplate”: {
“ContainerSpec”: {
“Image”: “registry.service.docker.swarm:5000/library/5953a38750657d002c6f9b7b_mvc_360_test1498653931792_0.1.0_100001711_1498653586085:latest@sha256:5b9ccbfe221a1b4ebc545c92c89981d05ee9d6001aba50be97dc00149684530c”,
“Labels”: {
“appLogDir”: “100001711/5953a38750657d002c6f9b7b/MC4xLjA=/serverId/MS42LjI=”,
“tenant”: “true”,
“usageReport”: “true”
},
“Command”: [
"/usr/local/bin/start_app"
],
“Args”: [
""
],
“Env”: [
“appid=5953a38750657d002c6f9b7b”,
“serverId=serverId”,
“orgid=100001711”,
“PORT=80”,
“NODE_VERSION=0.12.4”,
“NODE_ACS_URL=https://43dca5c1c71c6e302fb3fa4b6aa27b4210997dbb.cloudapp-enterprise-preprod.appctest.com”,
“ARROWCLOUD_APPID=5953a38750657d002c6f9b7b”,
“ARROWCLOUD_CONTAINER=Dev”,
“ARROWCLOUD_ORGID=100001711”,
“ARROWCLOUD_URL=https://admin.cloudapp-enterprise-preprod.appctest.com”,
“ARROWCLOUD_DOMAIN=cloudapp-enterprise-preprod.appctest.com”,
“ARROWCLOUD_VERSION=1.6.2”,
“ARROWCLOUD_DEPLOYED=Wed, 28 Jun 2017 12:39:56 GMT”,
“ARROWCLOUD_APPURL=https://43dca5c1c71c6e302fb3fa4b6aa27b4210997dbb.cloudapp-enterprise-preprod.appctest.com”,
“ARROWCLOUD_APP_LOG_DIR=100001711/5953a38750657d002c6f9b7b/MC4xLjA=/serverId/MS42LjI=”
],
“Mounts”: [
{
“Type”: “volume”,
“Target”: “/ctdebuglog”
},
{
“Type”: “bind”,
“Source”: “/appc/arrowcloud/app_data/100001711/mvc_360_test1498653931792”,
“Target”: “/data”
}
],
“Healthcheck”: {
“Test”: [
“CMD-SHELL”,
“curl --fail http://localhost:80/arrowPing.json || exit 1”
],
“Interval”: 2000000000,
“Retries”: 30
}
},
“Resources”: {
“Limits”: {
“MemoryBytes”: 268435456
},
“Reservations”: {
“MemoryBytes”: 268435456
}
},
“RestartPolicy”: {
“Condition”: “on-failure”,
“Delay”: 1,
“MaxAttempts”: 1
},
“Placement”: {
“Constraints”: [
“engine.labels.arrow_cloud_base_container == true”
]
},
“LogDriver”: {
“Name”: “json-file”,
“Options”: {
“max-file”: “3”,
“max-size”: “10M”
}
},
“ForceUpdate”: 0
},
“Mode”: {
“Replicated”: {
“Replicas”: 1
}
},
“UpdateConfig”: {
“Parallelism”: 1,
“Delay”: 5,
“FailureAction”: “pause”,
“MaxFailureRatio”: 0
},
“EndpointSpec”: {
“Mode”: “vip”,
“Ports”: [
{
“Protocol”: “tcp”,
“TargetPort”: 80,
“PublishMode”: “ingress”
}
]
}
},
“PreviousSpec”: {
“Name”: “5953a38750657d002c6f9b7b_mvc_360_test1498653931792”,
“Labels”: {},
“TaskTemplate”: {
“ContainerSpec”: {
“Image”: “registry.service.docker.swarm:5000/library/5953a38750657d002c6f9b7b_mvc_360_test1498653931792_0.1.0_100001711_1498653586085:latest@sha256:5b9ccbfe221a1b4ebc545c92c89981d05ee9d6001aba50be97dc00149684530c”,
“Labels”: {
“appLogDir”: “100001711/5953a38750657d002c6f9b7b/MC4xLjA=/serverId/MS42LjI=”,
“tenant”: “true”,
“usageReport”: “true”
},
“Command”: [
"/usr/local/bin/start_app"
],
“Args”: [
""
],
“Env”: [
“appid=5953a38750657d002c6f9b7b”,
“serverId=serverId”,
“orgid=100001711”,
“PORT=80”,
“NODE_VERSION=0.12.4”,
“NODE_ACS_URL=https://43dca5c1c71c6e302fb3fa4b6aa27b4210997dbb.cloudapp-enterprise-preprod.appctest.com”,
“ARROWCLOUD_APPID=5953a38750657d002c6f9b7b”,
“ARROWCLOUD_CONTAINER=Dev”,
“ARROWCLOUD_ORGID=100001711”,
“ARROWCLOUD_URL=https://admin.cloudapp-enterprise-preprod.appctest.com”,
“ARROWCLOUD_DOMAIN=cloudapp-enterprise-preprod.appctest.com”,
“ARROWCLOUD_VERSION=1.6.2”,
“ARROWCLOUD_DEPLOYED=Wed, 28 Jun 2017 12:39:56 GMT”,
“ARROWCLOUD_APPURL=https://43dca5c1c71c6e302fb3fa4b6aa27b4210997dbb.cloudapp-enterprise-preprod.appctest.com”,
“ARROWCLOUD_APP_LOG_DIR=100001711/5953a38750657d002c6f9b7b/MC4xLjA=/serverId/MS42LjI=”
],
“Mounts”: [
{
“Type”: “volume”,
“Target”: “/ctdebuglog”
},
{
“Type”: “bind”,
“Source”: “/appc/arrowcloud/app_data/100001711/mvc_360_test1498653931792”,
“Target”: “/data”
}
],
“Healthcheck”: {
“Test”: [
“CMD-SHELL”,
“curl --fail http://localhost:80/arrowPing.json || exit 1”
],
“Interval”: 2000000000,
“Retries”: 30
}
},
“Resources”: {
“Limits”: {
“MemoryBytes”: 268435456
},
“Reservations”: {
“MemoryBytes”: 268435456
}
},
“RestartPolicy”: {
“Condition”: “on-failure”,
“Delay”: 1,
“MaxAttempts”: 1
},
“Placement”: {
“Constraints”: [
“engine.labels.arrow_cloud_base_container == true”
]
},
“LogDriver”: {
“Name”: “json-file”,
“Options”: {
“max-file”: “3”,
“max-size”: “10M”
}
},
“ForceUpdate”: 0
},
“Mode”: {
“Replicated”: {
“Replicas”: 1
}
},
“UpdateConfig”: {
“Parallelism”: 1,
“Delay”: 5,
“FailureAction”: “pause”,
“MaxFailureRatio”: 0
},
“EndpointSpec”: {
“Mode”: “vip”,
“Ports”: [
{
“Protocol”: “tcp”,
“TargetPort”: 80,
“PublishMode”: “ingress”
}
]
}
},
“Endpoint”: {
“Spec”: {
“Mode”: “vip”,
“Ports”: [
{
“Protocol”: “tcp”,
“TargetPort”: 80,
“PublishMode”: “ingress”
}
]
},
“Ports”: [
{
“Protocol”: “tcp”,
“TargetPort”: 80,
“PublishedPort”: 30053,
“PublishMode”: “ingress”
}
],
“VirtualIPs”: [
{
“NetworkID”: “ik0on4i2beig2yz8hvwi659cn”,
“Addr”: “10.255.0.162/16”
}
]
}
}
]

But

was anyone able to find what the problem was with this?