Registry URL Parsing Fails When Port is Included
Before you start please confirm the following.
- [x] Yes, I've searched similar issues on GitHub.
- [x] Yes, I've checked whether this issue is covered in the Portainer documentation or knowledge base.
Problem Description
The compose-unpacker currently fails to parse registry URLs that include a port, resulting in a "Registry is malformed" warning and skipping login. The issue occurs because the code expects the registry string in the format username:password:host, but when a port is added (e.g., :5050), it results in four colon-separated components rather than three.
Expected Behavior
The compose-unpacker should correctly parse registry URLs that include a port, accommodating the format registry.example.com:port.
Actual Behavior
The current implementation splits the registry string by colon, expecting exactly only three components, and fails when a port is included, see compose_deploy.go in compose-unpacker project line 127/128.
Steps to Reproduce
Configure a registry URL with a custom port in the format registry.example.com:5050, with username and password. Deploy a stack using this registry configuration. The compose file must include at least one image from that custom registry with the port included. Observe the portainer docker log, look for "Registry is malformed" warning, indicating the login is skipped.
Portainer logs or screenshots
No response
Portainer version
2.35.0
Portainer Edition
Business Edition (BE/EE) with Starter license
Platform and Version
29.1.2
OS and Architecture
Ubuntu 22.04.5 LTS
Browser
Google Chrome
What command did you use to deploy Portainer?
Additional Information
Proposed Solution: Modify the parsing logic in compose_deploy.go to support registry URLs with ports by adjusting the strings, e. g. split operation to strings.SplitN(r, ":", 4) and using strings.Join(credentials[2:], ":") for the server address.
Additional Context: The issue prevents the use of registries that require a specific port, which is common in custom or self-hosted configurations.
@UseGitNotSvn can you please provide a screenshot and any logs?