Ansible docker multiple port mapping problem

- name: start container
  docker_container:
    name: "{{ warinfo[warname]["container"] }}"
    image: "{{ warinfo[warname]["image"] }}"
    state: started
    ports:
      - "{{ item[0]}}:{{ item[1] }}"
    with_items:
    - [8080,8081]
    - [8080,8081]

error prompt:

"The task includes an option with an undefined variable. The error was: "item" is undefined

prompt that the variable is not defined, whether the docker_container can not be looped, I read the document did not say,
how to map multiple ports at the same time?

Mar.22,2021
Menu