Docker + Persistent Registry = autodiscover failing

seems to be independent of having a persistent registry. but for some reason using this docker-compose.yml will sometimes fail with the above error:

version: '3.7'

services:
  redis:
    image: redis:3.2-alpine
    container_name: logs-logstash_redis

  logstash:
    image: docker.elastic.co/logstash/logstash:6.5.1
    depends_on:
      - redis
    environment:
      REDIS_HOST: redis
    entrypoint: /usr/local/bin/custom-entrypoint.sh

  filebeat:
    image: docker.elastic.co/beats/filebeat:6.5.1
    command:
      - -e
      - -strict.perms=false
    depends_on:
      - logstash
    environment:
      REDIS_HOST: redis
    volumes:
      - /var/log:/var/hostlog:ro
      - /var/lib/docker/containers:/var/lib/docker/containers:ro
      - /var/run/docker.sock:/var/run/docker.sock

  # only needed to generate logs
  nginx:
    image: nginx:1.14-alpine
    container_name: logs-logstash_nginx
    depends_on:
      - filebeat
    ports:
      - '127.0.0.1:8181:80'
    volumes:
      - ${PWD}/nginx.conf:/etc/nginx/nginx.conf:ro
    labels:
      com.foobar.logs.type: nginx