diff --git a/airflow/providers/docker/operators/docker.py b/airflow/providers/docker/operators/docker.py index 2216d925ed42d0..b02801aab034a6 100644 --- a/airflow/providers/docker/operators/docker.py +++ b/airflow/providers/docker/operators/docker.py @@ -275,7 +275,7 @@ def execute(self, context): # Pull the docker image if `force_pull` is set or image does not exist locally if self.force_pull or not self.cli.images(name=self.image): self.log.info('Pulling docker image %s', self.image) - for line in self.cli.pull(self.image, stream=True): + for line in self.cli.pull(self.image, stream=True, decode=True): output = json.loads(line.decode('utf-8').strip()) if 'status' in output: self.log.info("%s", output['status']) diff --git a/tests/providers/docker/operators/test_docker.py b/tests/providers/docker/operators/test_docker.py index 89ecad372bbfaf..068eaefacf189f 100644 --- a/tests/providers/docker/operators/test_docker.py +++ b/tests/providers/docker/operators/test_docker.py @@ -85,7 +85,8 @@ def test_execute(self, client_class_mock, tempdir_mock): client_mock.images.assert_called_once_with(name='ubuntu:latest') client_mock.attach.assert_called_once_with(container='some_id', stdout=True, stderr=True, stream=True) - client_mock.pull.assert_called_once_with('ubuntu:latest', stream=True) + client_mock.pull.assert_called_once_with('ubuntu:latest', stream=True, + decode=True) client_mock.wait.assert_called_once_with('some_id') @mock.patch('airflow.providers.docker.operators.docker.tls.TLSConfig')