https://prefect.io logo
#prefect-community
Title
# prefect-community
l

Luuk

03/10/2022, 12:28 PM
Does anyone have advice for docker agents to stay logged in on the Azure ACR? I have the docker agents running on my vm, it's logged in with an identity, but the
az acr login --name acrname
logs out after a couple hours and requires me to do it again. I also run the command within the docker image as well (for the docker agent) It's all working, but after a while I get logged out from the ACR and my flow starts to crash.
Error message:
500 Server Error for http+docker://localhost/v1.41/images/create?tag=latest&fromImage=acrname.azurecr.io%2Fimage: Internal Server Error ("Head https://acrname.azurecr.io/v2/image/manifests/latest: unauthorized: authentication required")
below the docker-compose file.
Copy code
version: "3.7"

services:
    agent:
      build:
        context: ./
        dockerfile: Dockerfile
      entrypoint: ["/bin/sh", "-c"]
      command:
        - |
          az acr login --name acrname
          prefect agent docker start --env PREFECT__CLOUD_USE_LOCAL_SECRETS=false
      volumes:
          - ${HOME}/.azure:/root/.azure
          - ${HOME}/.prefect:/root/.prefect
          - /var/run/docker.sock:/var/run/docker.sock
a

Anna Geller

03/10/2022, 1:14 PM
You talk to the right person 😂 I spent so many hours on this and Azure really doesn't make it easy. This Discourse page walks you through how you can set up long-lived credentials for your Docker agent on Azure: https://discourse.prefect.io/t/how-to-spin-up-a-docker-agent-on-azure-vm-a-full-walkthrough/407#authenticate-with-azure-6
TL;DR instead of using
az acr login
, you need to use:
Copy code
docker login <http://yourregistry.azurecr.io|yourregistry.azurecr.io> -u $USER_NAME -p $PASSWORD
🙌 1
l

Luuk

03/10/2022, 1:33 PM
I'm so glad to have you around here, always such a great help!
🙌 1
2 Views