1

I try to create service using docker-engine API and I use its request sample. but it does not create replicas (0/1)

what is wrong with it? note: I use Axios, express, and docker swarm. before this problem, I could create containers and stop them, and other things that you can do with docker-engine API. I just wanna create services with one replica. I am trying to create a REStful API for my docker swarm. here is my request sample:

{
    "Name": "mysql-app10",
    "TaskTemplate": {
        "ContainerSpec": {
            "Image": "mysql:5.7",
            "Mounts": [
                {
                    "ReadOnly": true,
                    "Source": "mysql  -app10",
                    "Target": "/var/lib/mysql",
                    "Type": "volume",
                    "VolumeOptions": {
                        "DriverConfig": {},
                        "Labels": {
                            "com.example.something": "something-value"
                        }
                    }
                }
            ],
            "Env": [ "MYSQL_ROOT_PASSWORD=2740072a563a948ff4af" ],
            "Command": [ "/bin/bash,mysqld,--default-authentication-plugin" ],
            "Hosts": [
                "10.10.10.10 host1",
                "ABCD:EF01:2345:6789:ABCD:EF01:2345:6789 host2"
            ],
            "User": "0",
            "DNSConfig": {
                "Nameservers": [
                    "8.8.8.8"
                ],
                "Search": [
                    "example.org"
                ],
                "Options": [
                    "timeout:3"
                ]
            }
        },
        "LogDriver": {
            "Name": "json-file",
            "Options": {
                "max-file": "3",
                "max-size": "10M"
            }
        },
        "Placement": {},
        "Resources": {
            "Limits": {
                "NanoCPUs": 20000000000,
                "MemoryBytes": 2147483648
            },
            "Reservations": {}
        },
        "RestartPolicy": {
            "Condition": "on-failure",
            "Delay": 10000000000,
            "MaxAttempts": 10
        }
    },
    "Mode": {
        "Replicated": {
            "Replicas": 1
        }
    },
    "UpdateConfig": {
        "Parallelism": 1,
        "Delay": 1000000000,
        "FailureAction": "pause",
        "Monitor": 15000000000,
        "MaxFailureRatio": 0.15
    },
    "RollbackConfig": {
        "Parallelism": 1,
        "Delay": 1000000000,
        "FailureAction": "pause",
        "Monitor": 15000000000,
        "MaxFailureRatio": 0.15
    },
    "EndpointSpec": {
        "Ports": [
            {
                "Protocol": "tcp",
                "PublishedPort": 33031,
                "TargetPort": 3306
            }
        ]
    },
    "Labels": {
        "foo": "bar"
    }
}
tgogos
  • 23,218
  • 20
  • 96
  • 128
Kasir Barati
  • 606
  • 13
  • 24

0 Answers0