acroos opened a new issue #8629:
URL: https://github.com/apache/airflow/issues/8629


   **Apache Airflow version**: 1.10.10
   
   **Environment**:
   
   - **Cloud provider or hardware configuration**: AWS
   - **OS** (e.g. from /etc/os-release): Ubuntu 16.04
   - **Python version**: 3.7.7
   
   **What happened**:
   
   When pulling a new image using the DockerOperator, the pull fails because 
[the pull 
method](https://docker-py.readthedocs.io/en/stable/api.html#docker.api.image.ImageApiMixin.pull)
 on docker-py's `APIClient` will return a generator of dicts when 
`decode=True`.  The docker operator expects that generator to return strings 
[as seen 
here](https://github.com/apache/airflow/blob/master/airflow/providers/docker/operators/docker.py#L274).
  The result is the following error:
   
   ```
   [2020-04-29 11:14:59,010] {taskinstance.py:1145} ERROR - 'dict' object has 
no attribute 'decode'
   Traceback (most recent call last):
     File 
"/usr/local/lib/python3.7/site-packages/airflow/models/taskinstance.py", line 
983, in _run_raw_task
       result = task_copy.execute(context=context)
     File 
"/usr/local/lib/python3.7/site-packages/airflow/operators/docker_operator.py", 
line 269, in execute
       output = json.loads(l.decode('utf-8').strip())
   AttributeError: 'dict' object has no attribute 'decode'
   ```
   
   **What you expected to happen**:
   
   The DockerOperator should be able to pull images regardless of log driver.  
It should handle both 'bytes' and 'dict' return types from the pull method.
   
   **How to reproduce it**:
   
   1. Set up your docker client to use the `json-file` log driver [instructions 
here](https://docs.docker.com/config/containers/logging/configure/#configure-the-default-logging-driver)
   2. Create a DAG with a single DockerOperator and set `force_pull=True`
   3. Run the DAG
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to