docker_image - manage docker images

Author:Pavel Antonov

Synopsis

New in version 1.5.

Create, check and remove docker images

Options

parameter required default choices comments
docker_url no unix://var/run/docker.sock
    URL of docker host to issue commands to
    name yes
      Image name to work with
      nocache no
        Do not use cache with building
        path no
          Path to directory with Dockerfile
          state no present
          • present
          • absent
          • build
          Set the state of the image
          tag no latest
            Image tag to work with
            timeout no 600
              Set image operation timeout

              Note

              Requires docker-py

              Examples


              Build docker image if required. Path should contains Dockerfile to build image:
              
              - hosts: web
                sudo: yes
                tasks:
                - name: check or build image
                  docker_image: path="/path/to/build/dir" name="my/app" state=present
              
              Build new version of image:
              
              - hosts: web
                sudo: yes
                tasks:
                - name: check or build image
                  docker_image: path="/path/to/build/dir" name="my/app" state=build
              
              Remove image from local docker storage:
              
              - hosts: web
                sudo: yes
                tasks:
                - name: remove image
                  docker_image: name="my/app" state=absent
              

              Table Of Contents

              Previous topic

              docker - manage docker containers

              Next topic

              ec2 - create, terminate, start or stop an instance in ec2, return instanceid