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

  • docker extra_host parameter expects a dictionary value for hostname, how can I use a variable?
  • How do you set encrypted Travis env variables in docker?
  • Ansible Variables only X times per host
  • Minor change in ansible playbook does not get updated in target host
  • Using Ansible to install Docker
  • Why ansible keeps recreating docker containers with state “started”
  • - name: deploy docker image
      sudo: yes
        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 docker file has an entry point

    ENTRYPOINT ["bin/my_application"]

  • GKE: Docker login alway succeeds, but push does not work even with valid credentials
  • Can not see files from Docker in Zeppelin
  • Docker \ how to pull only changed images
  • Request Entity Too Large - NextCloud in Docker
  • Dynamically load a Ruby container in Docker
  • download file with Rselenium & docker toolbox
  • 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.