run mysql:5.5 docker image from ansible
docker run -e MYSQL_ROOT_PASSWORD=pass mysql:5.5
it’s work ok. But if I run from ansible:
- name: run database local_action: module: docker image: mysql:5.5 state: running
it’s start and immediately stop. Also post in case 1 is 3306/tcp, but in case 2 there is no port.
One Solution collect form web for “run mysql:5.5 docker image from ansible”
You need to specify mysql root password as environment variable for container. For example:
- hosts: ansible_host gather_facts: False sudo: yes pre_tasks: - name: install pip pkg. yum: name: python-pip state: present - name: install boto pkg. pip: name: docker-py state: present - name: docker docker: image: "mysql:5.5" state: running env: "MYSQL_ROOT_PASSWORD=my-secret-pw"