https://prefect.io logo
c

Chris Gunderson

09/20/2022, 10:11 PM
Hi Team - I'm currently attempting to login to prefect via the docker image (DockerFile). I'm having an issue where it is asking for the profile name. Initially, there was an issue with the workspace, but I added that in the same line as the login. I'm not sure how to resolve this, because there is not a parameter for profile name like there is for workspace. Is there another way to do this?
Copy code
RUN /bin/sh -c "prefect cloud login -k $(cat ./api_key.txt) --workspace $(cat ./workspace.txt)"
1
k

Kevin Grismore

09/20/2022, 10:21 PM
instead of logging in, make your api key and api url environment variables. the prefect CLI will access them during command execution. the login command is just a place for you to build a profile with your api key if it isn't already available in that environment
upvote 1
🙏 1
🙏 1
c

Chris Gunderson

09/21/2022, 1:33 PM
@Kevin Grismore What does the environment variable need to be named? Are there any examples of this? I found the following in the documentation, but I'm not sure what the account id or workspace-id would be. Is the workspace-id whatever we set the workspace to be? i.e. prefect cloud workspace set --workspace "sra/dev" Is the API_KEY equal to my API Key? Should we create a service account for this? What are the best practices? $ prefect config set PREFECT_API_URL="https://api.prefect.cloud/api/accounts/[ACCOUNT-ID]/workspaces/[WORKSPACE-ID]" $ prefect config set PREFECT_API_KEY="[API-KEY]"
k

Kevin Grismore

09/21/2022, 2:45 PM
I recommend reading through this https://docs.prefect.io/concepts/settings/
👍 1
c

Chris Gunderson

09/21/2022, 4:11 PM
@Kevin Grismore If we are using a rotating API key for a prefect service account, how do we update this value in the docker image?
k

Kevin Grismore

09/21/2022, 6:19 PM
sorry, not sure about that one since I haven't used a service account before
👍 1
c

Chris Gunderson

09/21/2022, 6:20 PM
No worries, thanks Kevin.
Might be a question to raise to the team in case others using prefect have a similar issue.