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_r225562233
##########
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 , I have checked on a machine with Docker installed.
## Without Tag
```python
import docker
client = docker.APIClient(base_url='unix://var/run/docker.sock')
client.create_container(image="fake_image")
```
**Result:**
```
ImageNotFound: 404 Client Error: Not Found ("No such image:
fake_image:latest")
```
## With Tag
```python
import docker
client = docker.APIClient(base_url='unix://var/run/docker.sock')
client.create_container(image="fake_image:version_1")
```
**Result:**
```
ImageNotFound: 404 Client Error: Not Found ("No such image:
fake_image:version_1")
```
## Conclusion
So as I shared earlier: if tag is omitted for `image`, "latest" will be used
by default; if tag is provided by user, then that tag will be used.
So here in `DockerOperator`, we don't need to explicitly check & add
":latest".
----------------------------------------------------------------
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