Hi Dimitrios, The docker module works fine and by default the daemon option is true. The command/entrypoint of your Dockerfile must never return if you want to run as daemon. It has nothing to do with Ansible. First do the following: - run your docker process via command line (in daemon mode) - check that it runs properly (docker ps -a) - check the logs (docker logs <container_id>)
I did the same mistake when using docker. For instance to run mysql I thought running "service mysql start" would do the trick. But the "service" command starts the mysqld_safe process *and returns.* So even if I ask for a daemon mode it will always return. The way to go was to run the /usr/bin/mysqld_safe command. Check that you run the daemon process, not a wrapper around it: you should get better results. Regards, Louis Le mercredi 7 janvier 2015 18:02:36 UTC+1, Dimitrios Alexiou a écrit : > > Hello to everyone, > > I came across this issue and until now I haven't found a practical > solution. > > When running normally on my docker host this commad: docker run -d -p > 80:80 -v /var/run/docker.sock:/tmp/docker.sock -t dalexiou/nginx_docker-gen > > I am spinning up a container as a daemon. > > Now I have a playbook to automate this process. This playbook creates a > directory on the host I want to spin up the container, puts inside the > Dockerfile. Executes the Dockerfile to build the image and finally run the > image to start a daemon container. > > --- > - name: Create the nginx directory with the Dockerfile. > file: path=/home/finch/nginx state=directory > > - name: Copy the Dockerfile to the created nginx directory. > copy: src=Dockerfile dest=/home/finch/nginx/ > > - name: Build the nginx_docker-gen image from the copied Dockerfile. > docker_image: path="/home/finch/nginx/" name="dalexiou/nginx_docker-gen" > state=present > > - name: Run nginx_docker-gen container(s) from the image created before. > docker: > image: dalexiou/nginx_docker-gen > ports: > - 80:80 > volumes: > - /var/run/docker.sock:/tmp/docker.sock > name: nginx_lb > state: running > > The problem is that the playbook works fine with no errors. I can spin up > the docker container but not as a daemon. Is anyone coming across with the > same issue as well? > > Thanks in advance :-) > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/49605146-c668-4050-9bf1-aa626925c2d9%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
