Ed Morris
09/29/2021, 11:41 AMprefect register
method, during building of the custom docker image on the local machine. I can build the image using the underlying docker command, but only if I use the flag --network=host
in the build call. I have been successful in doing this before, I am using a newly installed VM for the submission, and so I am left wondering if there are default settings required for Docker.
Is there a flag or setting that needs to be added somewhere, either to Docker or to Prefect, that enables the container to access the external network and internet during build time?Antti Tupamäki
09/29/2021, 12:09 PMAntti Tupamäki
09/29/2021, 12:10 PMEd Morris
09/29/2021, 1:02 PMKevin Kho
docker build … --network=host
will help you with that, and then we can figure out how to add it on the Prefect side?
But I haven’t seen this kind of error. I think it would also help if you could exec into the container without --network=host
and try a simple API request with the urllib3
. From experience, the newer versions of this library have these kinds of issues and downgrading may help. If you have Prefect working already somewhere else, I think it would help to compare the versions of this libraryKevin Kho
Ed Morris
09/29/2021, 4:36 PMprefect register --project Examples -m "cub_tools_prefect.flows.cub_tools_train_flow"
This kicks off the compiling of the docker image ready for pushing it to our container registry.
The issue I have is that the docker installation fails when trying to install packages on the container as part of the container building process. I get the following errors:
Collecting flows...
Azure ML SDK version: 1.34.0
MLOpsConfiguration.load() called
[2021-09-29 11:44:58+0000] INFO - prefect | No ENV_FOR_DYNACONF environment variable found!!!
MLOpsConfiguration._setup_basic_env_vars returned false. No secrets will be loaded from vaults.
Processing 'cub_tools_prefect.flows.cub_tools_train_flow':
Building `Docker` storage...
[2021-09-29 11:44:58+0000] INFO - prefect.Docker | Building the flow's Docker storage...
Step 1/19 : FROM prefecthq/prefect:0.15.6-python3.8
---> 50e39b83641e
Step 2/19 : RUN python -m pip install --upgrade pip
---> Running in ef55ed5ed26f
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f932275beb0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/pip/
I have replicated this issue by pulling the prefect base docker image, and running the same command inside the interactive terminal:
(py38_azureml_prefect_cub200) edmorris@ecm-dev-gpu-001:~/projects/image_classification/Caltech_Birds_Prefect$ docker run -t -i prefecthq/prefect:0.15.6-python3.8
_____ _____ ______ ______ ______ _____ _______
| __ \| __ \| ____| ____| ____/ ____|__ __|
| |__) | |__) | |__ | |__ | |__ | | | |
| ___/| _ /| __| | __| | __|| | | |
| | | | \ \| |____| | | |___| |____ | |
|_| |_| \_\______|_| |______\_____| |_|
Thanks for using Prefect!!!
This is the official docker image for Prefect Core, intended for executing
Prefect Flows. For more information, please see the docs:
<https://docs.prefect.io/core/getting_started/installation.html#docker>
root@e920510dd437:/# python -m pip install --upgrade pip
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f949673dd60>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/pip/
This problem is solved by adding the --network=host
flag to the docker run command as follows:
(py38_azureml_prefect_cub200) edmorris@ecm-dev-gpu-001:~/projects/image_classification/Caltech_Birds_Prefect$ docker run -t -i --network=host prefecthq/prefect:0.15.6-python3.8
_____ _____ ______ ______ ______ _____ _______
| __ \| __ \| ____| ____| ____/ ____|__ __|
| |__) | |__) | |__ | |__ | |__ | | | |
| ___/| _ /| __| | __| | __|| | | |
| | | | \ \| |____| | | |___| |____ | |
|_| |_| \_\______|_| |______\_____| |_|
Thanks for using Prefect!!!
This is the official docker image for Prefect Core, intended for executing
Prefect Flows. For more information, please see the docs:
<https://docs.prefect.io/core/getting_started/installation.html#docker>
root@ecm-dev-gpu-001:/# python -m pip install --upgrade pip
Collecting pip
Downloading pip-21.2.4-py3-none-any.whl (1.6 MB)
|████████████████████████████████| 1.6 MB 18.2 MB/s
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 20.2.4
Uninstalling pip-20.2.4:
Successfully uninstalled pip-20.2.4
Successfully installed pip-21.2.4
Kevin Kho
Ed Morris
09/29/2021, 4:37 PMdocker build --network=host ./ -f Dockerfile-Prefect
Ed Morris
09/29/2021, 4:37 PM--network=host
flag, then I replicate the issue when the image is built with the prefect register
call.Kevin Kho
Ed Morris
09/29/2021, 4:40 PMKevin Kho
flow.storage = Docker(..., build_kwargs={"network_mode":"host"})
Kevin Kho
dockerpy
which just hits your installation. I wouldn’t know though what setting would cause this on the Docker side. How did you know to add --network=host
? I can try digging a bit with that as a starting pointEd Morris
09/29/2021, 4:50 PMKevin Kho
Ed Morris
09/29/2021, 4:51 PMKevin Kho
with Flow(...) as flow:
...
flow.storage = Docker(...)
Kevin Kho
Ed Morris
09/29/2021, 4:52 PMKevin Kho
register
is triggering a build haha. You should need to add it to that functionEd Morris
09/29/2021, 4:54 PMEd Morris
09/29/2021, 4:54 PMKevin Kho
Ed Morris
09/29/2021, 4:55 PMEd Morris
09/30/2021, 12:27 PMbuild_kwargs
argument of the Docker
class, which was used during the prefect register
call, was successful in building custom docker images locally and then pushing them to a container repository, registering the flow with the prefeft cloud and executing on Kubernetes.
Thank you.Kevin Kho
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.
Powered by