# Docker module required arguments - should image always be mandatory?

**URL:** <https://forum.ansible.com/t/docker-module-required-arguments-should-image-always-be-mandatory/17741>\
**Category:** Ansible Project\
**Created:** [March 13, 2015, 3:51pm UTC](https://forum.ansible.com/t/docker-module-required-arguments-should-image-always-be-mandatory/17741 "2015-03-13T15:51:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dave\_W](https://avatars.discourse-cdn.com/v4/letter/d/67e7ee/32.png) [@Dave\_W](https://forum.ansible.com/u/Dave_W)\
**Post date:** [March 13, 2015, 3:51pm UTC](https://forum.ansible.com/t/docker-module-required-arguments-should-image-always-be-mandatory/17741/1 "2015-03-13T15:51:16Z")

</div>

Hi there. I’m fairly certain the docker module is working as designed, but I wanted to make sure before I create an issue on github.

```auto
- name: stop docker container
  docker:
    name=myapp

```

```auto
    image=myappimage
    state=absent

```

```auto

```

```auto
I was poking around the docker.py code, and it seems like it's just "image = module.params.get('image')" that's doing it. 

```

```auto

```

```auto
But really, the image param shouldn't be required for every state. Right? Thanks!

```

```auto

```

```auto
--dave

```

```auto

```

```auto

```

```auto

```

```auto

```

---

<div class="post-metadata">

**Author:** ![Ash\_Wilson](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@Ash\_Wilson](https://forum.ansible.com/u/Ash_Wilson)\
**Post date:** [March 14, 2015, 5:16pm UTC](https://forum.ansible.com/t/docker-module-required-arguments-should-image-always-be-mandatory/17741/2 "2015-03-14T17:16:45Z")

</div>

Hi, Dave.

That’s a good point.

Really, all that you need to specify is a way to uniquely identify the set of containers that you want the task to operate on. This is either:

1. name, OR
2. image, plus optional command.

If you’re using a state that could _create_ a new container, then the image is required so that Docker knows what image to use, but for state=stopped, state=killed or state=absent, we shouldn’t require image if you’ve already specified a name. In fact, I think it’s ignored in those cases, so you can pass it a garbage value and no behavior will change.

A GitHub issue sounds like a good idea.

- Ash
