Im building a docker-compose service that probes for my db service to start before starting a test on my app. The docker-compose files worked great and I just created a new host with a docker machine and now I get an error when running:
docker-compose up agent
this is my docker-compose.yml
test:
build: ../../
dockerfile: docker/dev/Dockerfile
volumes_from:
- cache
links:
- db
environment:
DJANGO_SETTINGS_MODULE: todobackend.settings.test
MYSQL_HOST: db
MYSQL_USER: root
MYSQL_PASSWORD: password
TEST_OUTPUT_DIR: /reports
builder:
build: ../../
dockerfile: docker/dev/Dockerfile
volumes:
- ../../target:/wheelhouse
volumes_from:
- cache
entrypoint: "entrypoint.sh"
command: ["pip", "wheel", "--no-index", "-f /build", "."]
agent:
image: pjestrada/ansible
volumes:
- ../../ansible/probe.yml:/ansible/site.yml
links:
- db
environment:
PROBE_HOST: "db"
PROBE_PORT: "3306"
db:
image: mysql:5.6
hostname: db
expose:
- "3306"
environment:
MYSQL_ROOT_PASSWORD: password
cache:
build: ../../
dockerfile: docker/dev/Dockerfile
volumes:
- /tmp/cache:/cache
- /build
entrypoint: "true"
my playbook:
---
- name: Probe Host
hosts: localhost
connection: local
gather_facts: no
tasks:
- name: Set facts
set_fact:
probe_host: "{{ lookup('env', 'PROBE_HOST') }}"
probe_port: "{{ lookup('env', 'PROBE_PORT') }}"
probe_delay: "{{ lookup('env', 'PROBE_DELAY') | default(0, true) }}"
probe_timeout: "{{ lookup('env', 'PROBE_TIMEOUT') | default (180, true) }}"
- name: Message
debug:
msg: >
Probing {{ probe_host }}:{{ probe_port }} with delay={{ probe_delay }}s
and timeout={{ probe_timeout }}s
- name: Waiting for hosts to respond...
local_action: >
wait_for host={{ probe_host }}
port={{ probe_port }}
delay={{ probe_delay }}
timeout={{ probe_timeout }}
and my ansible Dockerfile:
FROM ubuntu:trusty
MAINTAINER Pablo Estrada <pjestradac@gmail.com>
# Prevent dpkg errors
ENV TERM=x-term-256color
RUN sed -i "s/http:\/\/archive./http:\/\/nz.archive./g" /etc/apt/sources.list
#Install ansible
RUN apt-get update -qy && \
apt-get install -qy software-properties-common && \
apt-add-repository -y ppa:ansible/ansible && \
apt-get update -qy && \
apt-get install -qy ansible
# Add voulme for Ansible Playbooks
Volume /ansible
WORKDIR /ansible
#Entrypoint
ENTRYPOINT ["ansible-playbook"]
CMD ["site.yml"]
The error I get says: ERROR! the playbook: site.yml does not appear to be a file
I dont understand why this happens if Im mapping the probe.yml to site.yml on my docker compose file. Is there anything wrong with my images?? Thanks for the help.
UPDATE
Aparently the issue happens when I start my docker machine and use
eval $(docker-machine env)
this is my docker machine info:
default * virtualbox Running tcp://192.168.99.100:2376 v1.12.1
When everything worked I did not have any docker host up with docker-machine. What can be happening here?