2
votes

TLDR; I want ansible to pull a docker image through http not https.

I have two VMs running in the same network. On one is a local docker registry. The other should pull images from the former via an ansible script. However, I get an error that the registry expects https and is http.

This seemed to solve the problem before. Ansible task for run Docker container from private registry

Unfortunateley, ansible docker: is outdated, and I need to use docker_container, and the latter does not have a insecure_registry option.

This is how it looks like now

  - name: Run kollega 
    docker_container:
      name: image_name
      image: "ip-to-registry/image:latest"
      ports:
        - "4000:4000"
      restart_policy: unless-stopped
      recreate: yes
      pull: yes
      env:

Is there some magic command I can add here to accept http registries, or must I just generate som self-signend certs?

1
Ansible does not pull. The target docker daemon does. Configure your registry as insecure: docs.docker.com/registry/insecure/#deploy-a-plain-http-registry - Zeitounator

1 Answers

2
votes

In the target node(s) you are reaching with ansible, add this to /etc/docker/daemon.json

{
  "insecure-registries" : ["your-registry:5000"]
}

systemctl restart docker

Reference