Docker Secrets Issue [SOLVED]

Good Day,

I am getting the following error when deploying a service :

docker stack deploy -c registry.yml registry
service registry: undefined secret “registry_auth.crt”

I have as follows :

docker secret create registry_auth.crt /opt/docker-registry/cert/registry_auth.crt
docker secret create registry_auth.key /opt/docker-registry/cert/registry_auth.key

My yaml file :

version: '3.1'

services:
  registry:
    image: registry:2
    deploy:
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
        window: 120s
    ports:
      - "5000:5000"
    secrets:
      - registry_auth.crt
      - registry_auth.key
    environment:
      REGISTRY_HTTP_ADDR: 0.0.0.0:5000
      REGISTRY_HTTP_TLS_CERTIFICATE: /run/secrets/registry_auth.crt
      REGISTRY_HTTP_TLS_KEY: /run/secrets/registry_auth.key
    volumes:
      - registry:/var/lib/registry

volumes:
  registry:
    driver: vsphere
    driver_opts:
      size: 99Gb
      diskformat: zeroedthick

What have I done incorrectly ?

Regards

Shaun

you’re missing the secrets top level section

secrets:
  registry_auth.crt:
    external: true

Awesome … thanks very much.