I'm trying to use the docker storage in a private ...
# prefect-community
s
I'm trying to use the docker storage in a private dockerhub repository. I can see that the build succeeds, but it fails when it get's to https://github.com/PrefectHQ/prefect/blob/master/src/prefect/environments/storage/docker.py#L425 The name it querys using the docker client is "docker.io/atheon/prefect-test::2020-12-01t12-57-38-789517-00-00" - but at this point the image has yet to be pushed so I don't know how this would ever succeed. Can someone point out where I'm going wrong? Many thanks!
Copy code
from prefect import Flow, task
from prefect.environments.storage import Docker
import sqlalchemy


@task
def some_task():
    print(sqlalchemy.__version__)


with Flow("test") as flow:
    some_task()

if __name__ == "__main__":
    flow.storage = Docker(
        registry_url="<http://docker.io/atheon|docker.io/atheon>",
        image_name="prefect-test",
        base_image="atheon/prefect-test:base",
    )
    flow.register(project_name="Development")
j
Hi Sam, I confess I'm not super familiar with non-dockerhub registries. The
Docker
storage class currently builds the image and tags it as
"{registry_url}/{image_name}:{image_tag}"
. It then checks that this image was created (there's likely a better way to do this). It appears that when the
registry_url
is something like
atheon
then things work out fine, but if it's
<http://docker.io/atheon|docker.io/atheon>
then the created image is just named
atheon/{image_name}:{image_tag}
. From reading, it looks like the current checks could be fixed by grabbing only the final segment in a
registry_url
path as the local image will have that alone in its name, but a lot of this docker code looks more complicated than it probably needs to be. For now, I believe switching to
registry_url="atheon"
should work for you (but maybe not) - we'll try to get this fixed before the next weekly release.
@Marvin open "Docker storage fails on some registry_urls"
s
Sorry @Jim Crist-Harif, I wasn't clear. I am trying to use private repos inside dockerhub
j
I understood that. Do private repos require the
<http://docker.io/|docker.io/>
prefix? (I have no experience with docker private repos). If not, dropping the prefix may work for you. Either way, I think we want to change how we validate image builds to avoid this issue entirely (hence the open issue).
s
ah I see. Thanks @Jim Crist-Harif I'll give it a try
Yes that worked, thank you for your help 🙂 I'll keep an eye out for this fix
👍 1