How to set run arguments when using Ansible to deploy docker?

When using ansible to deploy docker, how do you set the ARGs? That’s the ARGs in the following docker command

docker create  --name my_container my_image ARGS

I tried to set the ARGS in the docker: command variable but it wasn’t picked up.
What’s the correct way to set the run ARGS? Here is what I tried

  • Expose Docker Ports and Access with DNS for easier Ansible-Access
  • ansible docker module: unsupported parameter docker_api_version
  • ansible playbook: setup and connect to docker (authentication or permission failure)
  • Get internal IP address of Docker container using Ansible
  • Ansible Docker Connection Error
  • why ansible always replaces double quotes with single quotes in templates?
  • - name: deploy docker image
      sudo: yes
      docker:
        image: "{{ docker_image_name }}:{{ docker_image_version }}"
        state: reloaded
        name: "{{ docker_container_name }}"
        command: "{{ docker_args }}"
    

    in my group vars I have something like

    my_hosts:vars
      docker_args="-Dconfig=qa.conf"
    

    my docker file has an entry point

    ENTRYPOINT ["bin/my_application"]
    

  • service tomcat7 start fails, but the process exists and tomcat is running
  • How can i force remove a docker container using 'docker_container' module of Ansible?
  • Docker: TLS handshake timeout
  • Can a docker process access programms on the host with ipc
  • Can not add new user in docker container with mounted /etc/passwd and /etc/shadow
  • slow pg_restore on docker container startup
  • One Solution collect form web for “How to set run arguments when using Ansible to deploy docker?”

    You could simply use the shell module.

    We tried using the docker and docker_image modules a while back, and ran into issues. Docker has been moving so quickly that we simply fell back to using the shell module.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.