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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

getContainerByServiceName expects an instance name #4281

Open
aruiz14 opened this issue Jul 13, 2021 · 1 comment
Open

getContainerByServiceName expects an instance name #4281

aruiz14 opened this issue Jul 13, 2021 · 1 comment

Comments

@aruiz14
Copy link

aruiz14 commented Jul 13, 2021

#2314 brought support for selecting a container based on the service name when using docker-compose (thanks 馃檶 !). However, the value it expects contains the "container number" (e.g. service_1), instead of just the service name, e.g. just service.

This does not match the behaviour of using docker-compose directly:

$ docker-compose ps agent
      Name             Command       State   Ports
--------------------------------------------------
myapp_agent_1   /bin/k3s agent   Up
$ docker-compose ps agent_1
ERROR: No such service: agent_1

According to this test, it looks like the expected behavior, or maybe was incorrectly modeled.

Maybe using getServiceInstanceName from getContainerByServiceName would provide compatibility for both cases?

@mjh-c
Copy link

mjh-c commented Jun 23, 2022

I got hit by the same problem. To solve this I had to clone the private method getServiceInstanceName(String serviceName) to get the service instance name for a service name.
I have no idea how I can get the service instance name in any other way.

getServicePort() calls getServinceInstanceName in internally and therefore it works with both.

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

No branches or pull requests

2 participants