potiuk commented on a change in pull request #16932:
URL: https://github.com/apache/airflow/pull/16932#discussion_r669423095
##########
File path: airflow/providers/docker/operators/docker.py
##########
@@ -227,66 +240,66 @@ def get_hook(self) -> DockerHook:
def _run_image(self) -> Optional[str]:
"""Run a Docker container with the provided image"""
self.log.info('Starting docker container from image %s', self.image)
+ if not self.cli:
+ raise Exception("The 'cli' should be initialized before!")
+ if self.mount_tmp_dir:
+ with TemporaryDirectory(prefix='airflowtmp',
dir=self.host_tmp_dir) as host_tmp_dir:
+ tmp_mount = Mount(self.tmp_dir, host_tmp_dir, "bind")
+ target_mounts = self.mounts + [tmp_mount]
+ return self._run_image_with_mounts(target_mounts)
+ else:
+ return self._run_image_with_mounts(self.mounts)
- with TemporaryDirectory(prefix='airflowtmp', dir=self.host_tmp_dir) as
host_tmp_dir:
- if not self.cli:
- raise Exception("The 'cli' should be initialized before!")
- tmp_mount = Mount(self.tmp_dir, host_tmp_dir, "bind")
Review comment:
Changing the type of mount to `volume` does not change this. It still
fails. - with different error. The "volume" mount is there to mount the actual
"volumes" which are created and available in docker engine. It does fallback to
a "folder" if it is present but if it is missing, you still get an error.
So it fails with this error:
("create /tmp/airflowtmpct58fplr: "/tmp/airflowtmpct58fplr" includes invalid
characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are
allowed. If you intended to pass a host directory, use absolute path")
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]