Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect project name from docker-compose.yml #7905

Open
KES777 opened this issue Oct 22, 2022 · 4 comments
Open

Respect project name from docker-compose.yml #7905

KES777 opened this issue Oct 22, 2022 · 4 comments

Comments

@KES777
Copy link

KES777 commented Oct 22, 2022

Bug description
I have docker-compose.yml file which sets up project name. But portainer ignores it and creates stack/network with different name.

networks:
  office-net:
    external: true
  mail-net:

name: mail

image

image

image

Expected behavior
It should be named like: mail-mailserver-1, mail_mail-net

Steps to reproduce the issue:

  1. Create stack with some name
  2. provide custom docker-compose file with project name
  3. deploy stack

Technical details:

  • Portainer version: 15.1

  • Docker version (managed by Portainer): Docker version 20.10.18, build b40c2f6

  • Platform (windows/linux): Linux

  • Command used to start Portainer (docker run -p 9443:9443 portainer/portainer): docker run -d -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest

  • Browser: FF v105.0.1

  • Use Case (delete as appropriate): Using Portainer at Home

  • Have you reviewed our technical documentation and knowledge base? Yes/No

@tamarahenson
Copy link

@KES777

Can you attach your code for review and testing?

Thanks!

@KES777
Copy link
Author

KES777 commented Oct 23, 2022

@tamarahenson Services are not relevant here.

networks:
  office-net:
    external: true
  mail-net:
  #  name: mail-net

name: mail

services:
  mailserver:
    restart: unless-stopped
    image: docker.io/mailserver/docker-mailserver:latest
    container_name: mailserver
    hostname: mail
    domainname: mail.office
    env_file: mailserver.env
    volumes:
      - ./dms/mail-data/:/var/mail/
      - ./dms/mail-state/:/var/mail-state/
      - ./dms/mail-logs/:/var/log/mail/
      - ./dms/config/:/tmp/docker-mailserver/
      - /etc/localtime:/etc/localtime:ro
    stop_grace_period: 1m
    environment:
      - SUPERVISOR_LOGLEVEL=debug
      - LOG_LEVEL=trace
      - OVERRIDE_HOSTNAME=mail.office
      - ENABLE_SPAMASSASSIN=0
      - SPAMASSASSIN_SPAM_TO_INBOX=1
      - ENABLE_CLAMAV=0
      - ENABLE_FAIL2BAN=0
      - ENABLE_POSTGREY=1
      - ENABLE_SASLAUTHD=0
      - ONE_DIR=1
      - DMS_DEBUG=1
      - PERMIT_DOCKER=host
      - SPOOF_PROTECTION=1
    cap_add:
      - NET_ADMIN # For Fail2Ban to work
    networks:
      mail-net:
      office-net:
        ipv4_address: "172.22.22.2"
    healthcheck:
      test: "ss --listening --tcp | grep -P 'LISTEN.+:smtp' || exit 1"
      timeout: 30s
      retries: 0

@jamescarppe
Copy link
Member

@KES777 It looks like the name property is relatively new, and appears to have only been added in compose V2 2.3.0. We've only just moved to compose V2 recently and as such not all features have been fully integrated (especially ones like this that slip under the radar - it took me a fair bit of searching to find the above information).

Before compose V2 2.3.0, when using the docker compose command line the project name for a stack is either set by the directory name the compose file is in, or by using the -p or --project-name flags. Whatever you set in the Name field in Portainer when provisioning the stack is what is used in the equivalent of the -p flag.

Would I be right in assuming the precedence you'd prefer for this would be as follows?

  1. The name property in the compose file
  2. The value set in the Name field in Portainer

@KES777
Copy link
Author

KES777 commented Oct 25, 2022

@jamescarppe , Yes, you are right. I agree with that priority.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants