---
# tasks file for solr5_docker
- vars:
    docker_image_name: ucldc/solr
    dir_code: code/solr_api
- name: get the solr_api code
  git:  repo=https://github.com/ucldc/solr_api.git
        dest={{ dir_code }}
- name: docker build the image
  sudo: yes
  docker_image: name={{ docker_image_name }} path={{ dir_code }} state=present
- name: docker run the image with appropriate flags
  sudo: yes
  docker: 
    name: solr
    image: {{ docker_image_name }}
    state: restarted
    publish_all_ports: yes
    volumes: /opt/solr/index/:/opt/solr/server/solr/dc-collection/data:rw

---
# tasks file for solr5_docker
- vars:
    docker_image_name: ucldc/solr
    dir_code: code/solr_api
- name: get the solr_api code
  git:  repo=https://github.com/ucldc/solr_api.git
        dest={{ dir_code }}
- name: docker build the image
  sudo: yes
  docker_image: name={{ docker_image_name }} path={{ dir_code }} state=present
- name: docker run the image with appropriate flags
  sudo: yes
  docker: 
    name: solr
    image: {{ docker_image_name }}
    ports: 8983:8983
    state: restarted
    volumes: /opt/solr/index/:/opt/solr/server/solr/dc-collection/data:rw

Use explicit ports instead of publish_all_ports
Use explicit ports instead of publish_all_ports

publish_all_ports maps to random high ports, ok for container-container
but not from other machines.
