Fokko closed pull request #3977: [AIRFLOW-3132] Add option for DockerOperator URL: https://github.com/apache/incubator-airflow/pull/3977
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/airflow/operators/docker_operator.py b/airflow/operators/docker_operator.py index 517199be51..697f809657 100644 --- a/airflow/operators/docker_operator.py +++ b/airflow/operators/docker_operator.py @@ -47,6 +47,10 @@ class DockerOperator(BaseOperator): :param api_version: Remote API version. Set to ``auto`` to automatically detect the server's version. :type api_version: str + :param auto_remove: Auto-removal of the container on daemon side when the + container's process exits. + The default is False. + :type auto_remove: bool :param command: Command to be run in the container. (templated) :type command: str or list :param cpus: Number of CPUs to assign to the container. @@ -133,11 +137,13 @@ def __init__( docker_conn_id=None, dns=None, dns_search=None, + auto_remove=False, *args, **kwargs): super(DockerOperator, self).__init__(*args, **kwargs) self.api_version = api_version + self.auto_remove = auto_remove self.command = command self.cpus = cpus self.dns = dns @@ -209,6 +215,7 @@ def execute(self, context): cpu_shares=cpu_shares, environment=self.environment, host_config=self.cli.create_host_config( + auto_remove=self.auto_remove, binds=self.volumes, network_mode=self.network_mode, shm_size=self.shm_size, ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services