Skip to content

DockerMsftProvider method is deprecated for Windows Server 2022 and beyond #10

@kamranayub

Description

@kamranayub

This is the closest Ansible role I can find to what I'd like, but it's still not quite there for 2024 and beyond.

Within the last year, MS has deprecated support for DockerMsftProvider, which took me awhile to uncover but the new installation method and script is on the link to the docs in the README:

https://github.com/microsoft/Windows-Containers/tree/Main/helpful_tools/Install-DockerCE

What I've done in my own Ansible playbook is use win_chocolatey to install Docker CLI and Docker Engine on Windows Server 2022.

- hosts: windows

  tasks:
  - name: Configure Docker Engine for Windows
    win_chocolatey:
      name: docker-engine
      version: '27.1.1'
      state: present

  - name: Configure Docker CLI for Windows
    win_chocolatey:
      name: docker-cli
      version: '27.2.0'
      state: present

  - name: Start Docker service
    win_service:
      name: docker
      start_mode: auto
      state: started

  - name: Ensure that Docker is present on the global system path
    ansible.windows.win_path:
      elements: '%ProgramFiles%\docker'
      state: present
    register: docker_path

  - name: Reboot the Windows host
    ansible.windows.win_reboot:
      msg: "Reboot initiated by Ansible for Docker installation"
    when: docker_path.changed

  - name: Test Docker
    win_shell: docker --version

This works but the Microsoft helper script does do a few more things, like setup a transparent NAT which I haven't copied over yet. I think either I could use the win_get_url together with win_powershell to execute the helper script.

In my case, I pre-configure Windows Containers on first boot of the image, so by the time Ansible gets to the machine, it's installed.

The other thing that I need to figure out is docker login to a private registry.

I'm creating an issue, one so you're aware, but second maybe I can help contribute once I figure this all out 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions