Ansible docker_image – Building for Specific Platform

  ansible, docker

Trying to build a docker image using Ansible’s community.docker collection where the task takes place on an amd64 host but the docker image build is for arm64 targets.

I have created the following task:

- name: Tag and Push Docker Image {{ project.group }}/{{ project.name }} Version {{ version }} Build {{ build }}
  docker_image:
    name: '{{ project.group }}/{{ project.name }}'
    repository: '{{ registryIpPort }}/{{ project.group }}/{{ project.name }}:{{ version }}-BUILD-{{ build }}'
    tag: '{{ version }}'
    force_tag: yes
    push: yes
    source: build
    build:
      path: /home/ansible/git/{{ project.group }}/{{ project.name }}
      pull: no
      platform: arm64

However, when I run the task I get error:

"Unsupported parameters for (docker_image) module: platform found in build. Supported parameters include: args, cache_from, container_limits, dockerfile, etc_hosts, http_timeout, network, nocache, path, pull, rm, target, use_config_proxy"

Looking in community.docker.docker_image it says that platform was added in 1.1.0 of community.docker.

My installation is made up as follows:

ansible-galaxy version 2.9.6

community.docker collection version 1.7.0

Source: Docker Questions

LEAVE A COMMENT