I am using docker and I need specific configuration to persist into the containers
As every regular docker deployment with persistent data, you need to map a volume or bind mount inside the container. More information here: https://docs.docker.com/compose/compose-file/#volumes
Some useful examples are:
- Nginx main configuration:
Add this "volumes" directive on your docker-compose on the nginx section:volumes:
- "./nginx.conf:/etc/nginx/nginx.conf" - Nginx extra configurations folder:
Add this "volumes" directive on your docker-compose on the nginx section:volumes:
- "./nginx.conf.d/:/etc/nginx/nginx.conf.d/" - Nginx certficates (cert.pem and key.pem):
Add this "volumes" directive on your docker-compose on the nginx section:volumes:
- "./cert.pem:/etc/nginx/ssl/star_iriusrisk_com.crt"
- "./key.pem:/etc/nginx/ssl/star_iriusrisk_com.key" - Tomcat8 configuration:
volumes:
- "./catalina.properties:/usr/local/tomcat/conf/catalina.properties"
Also if you want to modify one of our already provided files by the container, you can copy it outside the container, then modify and mount it over the default container one.
This is an example with tomcat catalina.properties file:
1)
$ docker cp iriusrisk-tomcat8:/usr/local/tomcat/conf/catalina.properties .
2) Make your changes to the file.
3) Make this file persistent inside the container as just explained in the previous section.
Comments
0 comments
Article is closed for comments.