https://prefect.io logo
Title
y

YD

05/16/2022, 11:35 PM
Hi, How to register,
flow.register(...)
, a docker agent ? Can I have different docker agents running on a single server?
k

Kevin Kho

05/17/2022, 4:59 AM
Yes you can have multiple agents on a single server, but why do you need multiple docker agents? The Docker agent will spin up a new container anyway. I think the only time you would need multiple is if you had different labels on them. You just need to attach the
DockerRun
to your Flow
:upvote: 1
y

YD

05/17/2022, 3:25 PM
I am trying to find a solution to the situation that the registered tasks are running as the user used to start the agent on a machine. This is causing issues when multiple users, with different permissions are using the same machine. I was thinking that maybe each user, will stat its own agent, but was worried it will create a mess, so I was wondering if doing it with docker agents might be the way to go
k

Kevin Kho

05/17/2022, 3:57 PM
Multiple agents may solve this. I’m not 100% sure. As long as you can keep them running simultaneously, I guess it could work
y

YD

05/17/2022, 9:33 PM
what is not so clear to me, is how to register the flow with a specific agent, if both agents are running on the same machine at the same time
k

Kevin Kho

05/17/2022, 9:35 PM
It would be by adding labels
y

YD

05/18/2022, 4:48 PM
So, it should looks like: On a single server User 1 - Start agent
prefect agent local start -l team_1
User 2 - Start agent
prefect agent local start -l team_2
Then to register the flow User - 1
flow.register(project_name="some project", labels=['team_1'])
User - 2
flow.register(project_name="some other project", labels=['team_2'])
Is this correct ? is this how it works with the enterprise Prefect as well?
k

Kevin Kho

05/18/2022, 4:55 PM
Yes exactly and yes it’s the same on Prefect Cloud
y

YD

05/18/2022, 5:28 PM
thanks, will try that
Worked well Thanks
👍 1