Docker registry location with error: No such picture: localhost: 5000

Good morning everyone

I have had a problem for two days that I can not solve.
I've set up a 3-machine environment with Docker Swarm, a manager machine, and two nodes.

The problem, when I start a service in the manager, I get the error: No such picture: localhost: 5000 / integracao-toa

I tried to create the local registry in Machine Manager in two ways:

1 – as a service

docker service create --name registry - public Published = 5000, destination = 5000, mode = host registry: 2

As a service, I can not move the image:

[root@tslxdocker-hlg docker]# docker service create --name registry - public Published = 5000, destination = 5000, mode = hostreg: 2
1z0a64ulmdvu6f2k08omgg3fj
Overall Progress: 1 of 1 tasks
1/1: running   [==================================================>]
Verify: service converges
[root@tslxdocker-hlg docker]# docker push localhost: 5000 / integracao-toa
The push refers to the repository [localhost:5000/integracao-toa]
Get http: // localhost: 5000 / v2 /: dial tcp 127.0.0.1:5000: connect: connection: connection: connection: connection: connection: connection: connection: connection: connection: connection: connection: connection: connection: Connection: Connection: Connection:

As a service, I refused the connection.
However, I can connect to the registry on the other two host computers:

curl localhost: 5000 / v2 / _catalog
{ "Repositories":[]}

I created the file /etc/docker/daemon.json and restarted the docking service

[root@tslxdocker-hlg docker]# cat /etc/docker/daemon.json
{
"Insecure-registries"[
        "localhost:5000",
        "127.0.0.1:5000"
    ]
}

I also tried commenting on the "localhost" line in / etc / hosts
The error remains

2 – as a container

Docker-Run -d -p 5000: 5000 --restart = Registration of the registry file "--name": 2

As a basic container, I can move the image in the registry, but the other nodes can not connect to the registry:

Slide the image successfully:

[root@tslxdocker-hlg docker]# docker run -d -p 5000: 5000 --restart = always --name Registry Registration: 2
397f6fe083da78d5d0f08be3dfa336c01e328d8bbd46637dd52ac5b479a48c11
[root@tslxdocker-hlg docker]# docker push localhost: 5000 / integracao-toa
The push refers to the repository [localhost:5000/integracao-toa]
82c687db4923: Pressed
pushed
bd029db62750: Pressed
03861ebeff3b: Pressed
286ab5bbe85e: Pressed
en2051a29c4c: Pressed
bac22f4e2b6a: Pressed
538ca12fd712: Pressed
f75e64f96dbc: Pressed
8f7ee6d76fd9: Pressed
c23711a84ad4: pressed
90d1009ce6fe: Pressed
last: Diga: sha256: a6adadccfc2914d4a88f74cd8fba58105d223596e5b32ef7f71754056817e3f4 Size: 2849

Error adding service in swarm:

    docker service create --name integracao-toa --constraint node.labels.group == group01 - replica 2 -p 3000: 80 localhost: 5000 / integracao-toa
u1fwfqjs1vn1ml8665vbprzov
Overall Progress: 0 of 2 tasks
1/2: No such picture: localhost: 5000 / integracao-toa: latest @ sha256: a6adadccfc2914d ...
2/2: No such picture: localhost: 5000 / integracao-toa: latest @ sha256: a6adadccfc2914d ...

It is also interesting that the nodes as containers can not connect to the registry either:

curl localhost: 5000 / v2 / _catalog
curl: (7) Connection to localhost failed: 5000; connection denied

So I do not know what else to do, and I have one more question. What's the best way to run the local registry? how service or with docker run?