Skip to content

Add option to set container name#193

Open
dododedodonl wants to merge 1 commit into
containers:mainfrom
dododedodonl:add-container-name-flag
Open

Add option to set container name#193
dododedodonl wants to merge 1 commit into
containers:mainfrom
dododedodonl:add-container-name-flag

Conversation

@dododedodonl

Copy link
Copy Markdown
Contributor

When converting from a compose file, container_name might not be set. The flag added gives the option to set the service's key as container name when it is not set already.

@k9withabone

k9withabone commented Feb 25, 2026

Copy link
Copy Markdown
Member

@TheRealBecks what do you think of this new option?

@TheRealBecks

TheRealBecks commented Mar 9, 2026

Copy link
Copy Markdown
Collaborator

I may have overlooked it, but how do I set --add-container-name when there are several services defined? When there's no container_name Podman generates names for services as <project-name>-<service-name>-<number-starting-at-1>.

Also container_name does not allow scaling as there can't be two containers with the same name for one service, see compose-spec#container_name

So keep in mind that this command collides with:

@k9withabone Is there a way to make scale and container_name mutually exclusive per service? replicas is not yet implemented.

@TheRealBecks

Copy link
Copy Markdown
Collaborator

@k9withabone Any thoughts on this?

@k9withabone

Copy link
Copy Markdown
Member

As replicas is part of the Compose Deploy Specification, which is not supported, we don't have to worry about that. My understanding is that deploy is for when you are deploying your Compose file to some PaaS (platform as a service), so it doesn't make sense for Podlet to ever support it.

I believe scale is used by Docker Swarm which doesn't have a Podman equivalent, so it's not supported by Podlet.

@TheRealBecks

Copy link
Copy Markdown
Collaborator

Okay, so let's come back to my first question:

@dododedodonl I may have overlooked it, but how do I set --add-container-name when there are several services defined?

@dododedodonl

Copy link
Copy Markdown
Contributor Author

Okay, so let's come back to my first question:

@dododedodonl I may have overlooked it, but how do I set --add-container-name when there are several services defined?

In a lot of my docker-compose files, no container name is set, only a service name with only one container. This toggle allows a user to use the service name as container name, instead of relying on the auto generated <project-name>-<service-name>-<number-starting-at-1>, it becomes <service-name>.

@TheRealBecks

TheRealBecks commented May 19, 2026

Copy link
Copy Markdown
Collaborator

@dododedodonl Thanks, I finally understand how this works: It a boolean flag, I missed that directly at the beginning of the source code 😂

@k9withabone Yeah, this feature sounds good to me!

@dododedodonl Please rebase again

@TheRealBecks TheRealBecks added this to the v0.3.3 milestone May 19, 2026
Signed-off-by: Tom Janssen <tom@dcc.team>
@dododedodonl dododedodonl force-pushed the add-container-name-flag branch from c07928a to e080ca5 Compare May 19, 2026 12:39
@TheRealBecks TheRealBecks requested a review from k9withabone May 19, 2026 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants