desc = name must be valid as a dns name component

I am trying to deploy minio to my docker cluster, and I am basing my docker-compose script from the auto generated one found on minio.io

The problem is that when trying to deploy it to my cluster I am getting the error desc = name must be valid as a dns name component, which after searching the web abit seems to mostly be related to container names containing .. However mine doesn't, so I am wonder what is causing this error, as I am not seeing anything that would not be a valid dns URL(I am most likely wrong)

The docker compose file:

version: '3'

services:
 minio1:
  image: minio/minio
  volumes:
   - minio-data1:/export
  ports:
   - "9001:9000"
  networks:
   - minio_distributed
  environment:
   MINIO_ACCESS_KEY: <ACCESS>
   MINIO_SECRET_KEY: <SECRET>
  deploy:
   restart_policy:
    delay: 10s
    max_attempts: 10
    window: 60s
  command: server http://minio1/export http://minio2/export http://minio3/export http://minio4/export 

 minio2:
  image: minio/minio
  volumes:
   - minio-data2:/export
  ports:
   - "9002:9000"
  networks:
   - minio_distributed
  environment:
   MINIO_ACCESS_KEY: <ACCESS>
   MINIO_SECRET_KEY: <SECRET>
  deploy:
   restart_policy:
    delay: 10s
    max_attempts: 10
    window: 60s
  command: server http://minio1/export http://minio2/export http://minio3/export http://minio4/export 

 minio3:
  image: minio/minio
  volumes:
   - minio-data3:/export
  ports:
   - "9003:9000"
  networks:
   - minio_distributed
  environment:
   MINIO_ACCESS_KEY: <ACCESS>
   MINIO_SECRET_KEY: <SECRET>
  deploy:
   restart_policy:
    delay: 10s
    max_attempts: 10
    window: 60s
  command: server http://minio1/export http://minio2/export http://minio3/export http://minio4/export 

 minio4:
  image: minio/minio
  volumes:
   - minio-data4:/export
  ports:
   - "9004:9000"
  networks:
   - minio_distributed
  environment:
   MINIO_ACCESS_KEY: <ACCESS>
   MINIO_SECRET_KEY: <SECRET>
  deploy:
   restart_policy:
    delay: 10s
    max_attempts: 10
    window: 60s
  command: server http://minio1/export http://minio2/export http://minio3/export http://minio4/export 

volumes:
  minio-data1:
  minio-data2:
  minio-data3:
  minio-data4:

networks:
 minio_distributed:
  driver: overlay

So there is obviously something that I am not understanding propperly


Solution 1:

When creating the stack in portainer, the stack name is used to create the networks names (<stack_name>_<network_name>). So if it contains unauthorized chars (like . or space), then the network name will get refused. Name your stack without any special char and you can deploy it.