I am trying to give my pi-hole container a static IP address. The following 
works the way I want:

# docker network create --subnet=172.18.0.0/16 docker1
# docker run -d --name pihole -p 53:53/tcp -p 53:53/udp -p 80:80 -e 
ServerIP=212.237.9.209 --net docker1 --ip 172.18.0.2 diginc/pi-hole:alpine
# docker inspect pihole | grep NetworkMode
            "NetworkMode": "docker1",

But with Ansible's docker_container, I get "NetworkMode": "default", and 
then I can't access the IP address from another container:

This part I tested and works the same:

- docker_network:
    name: docker1
    ipam_options:
      subnet: 172.18.0.0/16

Now here lies the problem:

- docker_container:
    name: pihole
    image: diginc/pi-hole:alpine
    ports:
      - '53:53/tcp'
      - '53:53/udp'
      - '80:80'
    networks:
      - name: docker1
        ipv4_address: 172.18.0.2
    env:
        ServerIP: '{{ inventory_hostname }}'

Your help will be appreciated!

-- 
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/5518d367-3990-4ba1-b62c-c6b41f72c383%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to