XD-DENG commented on a change in pull request #4049: [AIRFLOW-3203] Fix
DockerOperator & some operator test
URL: https://github.com/apache/incubator-airflow/pull/4049#discussion_r225487222
##########
File path: airflow/operators/docker_operator.py
##########
@@ -187,35 +188,28 @@ def execute(self, context):
tls=tls_config
)
- if ':' not in self.image:
- image = self.image + ':latest'
- else:
- image = self.image
Review comment:
Hi @ashb , this is because I found out that this will be handled by `docker`
package itself.
Here this operator is using `docker.APIClient.create_container(image=...)`
to create the container under the hood. If the `image` is just the name withOUT
tag, say `"fake_image"`, then the program will go search for
`"fake_image:latest"` by default (of course it will search for the tag given by
user if user has specified the tag).
You can try the code below to validate:
```python
import docker
client = docker.APIClient(base_url='unix://var/run/docker.sock')
client.create_container(image="fake_image")
```
It will tell you something like `"'fake_image:latest' can't be found"` (I
don't have Docker on the laptop I'm using at this moment so can't provide the
exact exception). Please help double-validate.
Cheers
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services