I have an Ansible container and when I have developed a docker-compose file create the container.
version: '2'
services:
ansible_tower:
image: ybalt/ansible-tower:latest
ports:
- "333:443"
volumes:
- ./certs:/certs
- /var/lib/postgresql/9.4/main
- ./backup:/home/backup
privileged: true
container_name: ansible_tower
restart: always
but when I remove the container and when I recreate the container all the volume data are lost. (PostgreSQL data will be lost.) After a bit of debugging I have found that the host volumes are getting remapped with the newly created volumes when the container is getting recreated. ( The unnamed host volume name changes)But this is not what expected I thought the host volumes will get reused in the event of container recreation. What have I missed in here. Due to this all the data will be lost.