Hi all! This may be more of a Docker SDK question,...
# ask-community
j
Hi all! This may be more of a Docker SDK question, but was hoping a friendly prefecter might have encountered this issue. I'm trying to bind a Windows network path for my flow's run_config. I read the Docker SDK docs on create_host_config, but not sure what I am supposed to change. For example:   1) I can use the code below to successfully bind a local file path (for read/write) to a Docker container   2) However, if I use a UNC path to a network drive, I receive a "Server Error" that the path is not a valid Windows path Any help is welcome, thank you!
Copy code
### THIS CODE ALLOWS ME TO BIND A LOCAL FILE PATH
from prefect.run_configs import DockerRun
import docker

  flow.run_config = DockerRun(labels=['my-label']
                            ,host_config={'mounts':[docker.types.Mount(target='/public'
                                                                        ,source=r'//c/some/local/path'
                                                                        ,type='bind')
                                                ]
                                        }
                        )

### THIS CODE THROWS ERROR 
  flow.run_config = DockerRun(labels=['my-label']
                            ,host_config={'mounts':[docker.types.Mount(target='/public'
                                                    ,source=r'\\path\to\windows\network\shared\drive'
                                                                        ,type='bind')
                                                ]
                                        }
                        )
k
I am really not sure on this. Have you seen this ? Wondering if that works and then we can figure out how to get it in the host config
j
That looks similar to this solution I found; looks like the "--opt" switches are set with "driver_config" which is inside "mount" argument to "create_host_config". Will give it whirl and report back -- thank you!
Unfortunately after playing around with this for a bit, I've gotten closer, but still unable to work. I am getting an "Invalid argument" error, but not clear which argument is invalid. I also tried setting the source to the UNC path, but doesn't like that either. I've also tried sending user/pass to argument "o" as in the link above, but didn't like that either. 😕
Copy code
### THIS CODE THROWS AN INVALID ARGUMENT ERROR
flow.run_config = DockerRun(labels=['TGLO-CONSULTDT6','qsbase3']
                                    ,host_config={'mounts':[
                                        docker.types.Mount(target='/public'
                                                            ,source='local'
                                                            ,type='volume'
                                                            ,driver_config=docker.types.DriverConfig(name='local'
                                                                                                    ,options={'type':'cifs'
                                                                                                            ,'device':r'\\path\to\windows\network\drive'
                                                                                                            ,'credentials':'user=<username>,domain=<windows_domain>,password=<password>'
                                                                                                            }
                                                                                                    )  
                                                            )
                                                        ]
                                                }           
                            )
k
Oh sorry I dont think I can help with this 😅. Let’s see if the community chimes in.
👍 1