# How Ansible knows whether a docker image has changed?

**URL:** <https://forum.ansible.com/t/how-ansible-knows-whether-a-docker-image-has-changed/18573>\
**Category:** Ansible Project\
**Created:** [June 23, 2015, 10:37am UTC](https://forum.ansible.com/t/how-ansible-knows-whether-a-docker-image-has-changed/18573 "2015-06-23T10:37:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dr\_Hector\_Valverde\_P](https://avatars.discourse-cdn.com/v4/letter/d/85e7bf/32.png) [@Dr\_Hector\_Valverde\_P](https://forum.ansible.com/u/Dr_Hector_Valverde_P)\
**Post date:** [June 23, 2015, 10:37am UTC](https://forum.ansible.com/t/how-ansible-knows-whether-a-docker-image-has-changed/18573/1 "2015-06-23T10:37:12Z")

</div>

Hi all,

I’m using the [Docker module Ansible provides](http://docs.ansible.com/docker_module.html) and I’m currently facing a little problem with it. I need further information to find the solution.

Here is the task I’m using in the playbook:

`

- name: Run the docker container for the service in QA  
docker:  
docker\_api\_version: “1.17”  
name: “{{ service }}”  
image: “{{docker\_image\_uri}}:{{ docker\_tag }}”  
env: “{{ ENV\_VARS }}”  
state: reloaded  
pull: always  
ports: “{{http\_port}}:5000”  
`

I’m using exactly the same code for 4 different services I’m deploying but I have the following problem with two of them:

**The docker container is always reloaded regardless the docker image has changed or not**

Given that situation, I need to understand how Ansible makes the decision to restart the container or not.

I hope I’ve been clear enough in my question. Any insight?

Thanks in advance.

The information contained in this message is for the intended addressee only and may contain confidential and/or privileged information. If you are not the intended addressee, please delete this message and notify the sender; do not copy or distribute this message or disclose its contents to anyone. Any views or opinions expressed in this message are those of the author and do not necessarily represent those of Motortrak Limited or of any of its associated companies. No reliance may be placed on this message without written confirmation from an authorised representative of the company.

Registered in England 3098391 V.A.T. Registered No. 667463890
