Ansible Minio Docker setup

Monday Apr 20, 2020 | ansible, docker, minio

I had troubles starting a minio docker container with Ansible. It was a minior error on my part, but i want to spare you the pain!

I was missing the command: ["server /data"] entry, which led the minio container to restart every few seconds -.-


- name: Start minio Docker Container
  tags:
    - minio
  docker_container:
    name: "{{ minio__docker_name }}"
    restart_policy: "unless-stopped"
    hostname: "{{ minio__external_url }}"
    command: ["server /data"]
    image: "minio/minio:{{ minio__version }}"
    env:
      MINIO_ACCESS_KEY: "{{minio__access_key}}"
      MINIO_SECRET_KEY: "{{minio__secret_key}}"
    ports:
    - "{{minio__http_port}}:9000"
    volumes:
     - "{{minio__data_dir}}/data:/data"


If you are using jwilders nginx reverse proxy with Let’s Encrypt companion:

- name: Start minio Docker Container
  tags:
    - minio
  docker_container:
    name: "{{ minio__docker_name }}"
    restart_policy: "unless-stopped"
    hostname: "{{ minio__external_url }}"
    command: ["server /data"]
    image: "minio/minio:{{ minio__version }}"
    env:
      VIRTUAL_HOST: "{{minio__external_url}}"
      VIRTUAL_PORT: "{{minio__http_port}}"
      LETSENCRYPT_HOST: "{{minio__external_url}}"
      MINIO_ACCESS_KEY: "{{minio__access_key}}"
      MINIO_SECRET_KEY: "{{minio__secret_key}}"
    ports:
    - "{{minio__http_port}}:9000"
    volumes:
     - "{{minio__data_dir}}/data:/data"

It took a while to figure it out :D