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:

  • Get IP address of Docker with Ansible
  • ansible docker module: unsupported parameter docker_api_version
  • Ansible Variables only X times per host
  • Network connection between 2 Docker Container (JBOSS/DATABASE)
  • How to keep docker containers running when they are installed with ansible
  • Ansible docker_container module env file
  • - 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.

  • How to run docker to process host file
  • Can docker containers be used for live migration of a group of running applications?
  • Cannot launch interactive session in Windows IIS Docker container
  • setting up local drone server: Unable to login. Registration is closed
  • What is the difference between kubernetes and GKE?
  • Wrap origin public Dockerfile to manage build args, etc
  • 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.