Hi everyone — is there a way to register a flow wi...
# ask-community
b
Hi everyone — is there a way to register a flow with Docker storage from within a docker container? I’m thinking if there’s something clever I can do but not sure
k
Hey @Bruno Murino, how are you trying to register it now and what problem do you run into?
b
I run my CI/CD pipeline from containers, like step1 = docker build step2 = docker run bash -c “make test” step3 = docker run bash -c “make deploy” and my “deploy” command is basically “flow.register( args )”
k
Sorry I’m not seeing the problem. Is the Docker storage building a local image or uploading that image somewhere?
b
uploading the image to an ECS repo
I managed to solve the “docker in docker” problem my mounting the docker.sock, but now I’m having problems authenticating for the “docker push” that the “flow.register()” command does
k
If that is for ECR, are you doing something like
aws ecr get-login-password _--_region us-east-2 | docker login _--_username AWS _--_password-stdin <http://XXXXXXXX.dkr.ecr.us-east-2.amazonaws.com|XXXXXXXX.dkr.ecr.us-east-2.amazonaws.com>
. Replace the region and URI?
b
yep! I managed to solve my problem but logging in before running the flow.register
👍 2
d
Hey @Bruno Murino, I'm running into exactly the same problem right now. I'm also mounting the docker socket into the container which is enough for prefect to build an image successfully, but the authentication for the push doesn't work. Could you elaborate on how you solved it? Did you use a host container with docker installed and then authenticate via the cli like
docker login
? Or is there a possibility to authenticate via prefect or environment variables?
b
I haven’t finished testing yet, but locally the following works. I’ve added this to a Makefile:
Copy code
deploy:
	aws --profile devops ecr get-login-password --region eu-west-1 | docker login --username AWS --password-stdin <my-url>
	DEPLOYMENT_ENV=${DEPLOYMENT_ENV} PREFECT__SERVER__ENDPOINT=<https://prefect>.${DEPLOYMENT_ENV}<http://env.landbay.co.uk/api/graphql|env.landbay.co.uk/api/graphql> PREFECT__API__HOST=<https://prefect>.${DEPLOYMENT_ENV}<http://env.landbay.co.uk/api/graphql|env.landbay.co.uk/api/graphql> poetry run python src/deploy.py
k
@deltikron @Bruno Murino I am hitting the exact same problem it seems! Would you mind sharing how you mounted your docker.sock to successfully get Prefect to build your Flock images?
b
sure, I mounted the sock with just “-v /var/run/docker.sock:/var/run/docker.sock” on my docker run command
k
@Marvin archive “Running Docker agent in Docker container”