run mysql:5.5 docker image from ansible

How to run mysql: 5.5 from ansible? If I run it directly:

docker run -e MYSQL_ROOT_PASSWORD=pass mysql:5.5

it’s work ok. But if I run from ansible:

  • How to update docker in aws ec2
  • Launch Docker Container using ansible-playbook from a locally available docker image
  • When moving the Docker in Ansible, it does not allow you to specify the dns
  • Ansible docker module picks random port by default
  • Network connection between 2 Docker Container (JBOSS/DATABASE)
  • Ansible and docker-py
  • - name: run database
        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.

  • Docker IO Error with local js file
  • Packaging Docker on OpenWrt
  • Docker Alpine nginx 403 Forbidden error for swagger-ui-builder
  • Azure Docker Container - how to pass startup commands to a docker run?
  • Docker compose postgresql service - can't create user and database during build?
  • How to run PHP in Kubernetes via unix socket?
  • 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
        - name: install pip pkg.
            name: python-pip
            state: present
        - name: install boto pkg.
            name: docker-py
            state: present
        - name: docker
            image: "mysql:5.5"
            state: running
            env: "MYSQL_ROOT_PASSWORD=my-secret-pw"
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.