Env variables in static xml files

I just started to use Docker and I find it’s wonderful. I tried to build a 2 containers environment for Magento, first container for apache and second for mysql. I linked the two containers together and I installed Magento on the apache container, using as DB Host the Mysql container. I obtained the ip of the linked mysql container from the env variable typing “env” on the apache container. It works fine, but the problem is that Magento saves the ip of the mysql server in the local.xml file. If I rebuild the mysql container it obtains a new ip address and magento stops to work until I update the local.xml file. Working on a php setting file (i.e. in wordpress) i can use the function getenv("MYSQL_PORT_3306_TCP_ADDR") to dynamically obtain the correct ip address, but what can I do if it’s saved in a static file xml file like in Magento?

  • Why is Internal memory in java Native Memory Tracking increasing
  • Docker and SSH for development with phpStorm
  • Kubernetes 1.2alpha8 AWS Container Registry Integration
  • Yesod scaffolded site browserId TlsException
  • What is the correct way of using a custom Dragonfly storage backend in Refinery?
  • Start node app when running docker container from cli
  • Unable to pull docker image, getting 'remote error: access denied'
  • How to override default docker container command or revert to previous container state?
  • Can't access rexster interface via browser — connection refused
  • How can i force remove a docker container using 'docker_container' module of Ansible?
  • docker-py: Accessing output of python script run in ENTRYPOINT command
  • Running Tomcat with PostgreSql using Dockerfile
  • One Solution collect form web for “Env variables in static xml files”

    I found it! When a container is linked to another through –link option, docker automatically add an entry in the container /etc/hosts, with the alias and the ip address of the just linked container!  mysql 9e37a5c0a444 my-mysql

    I have only to substitute the IP address of the mysql server with the hostname (mysql or my-mysql) and it works also when the IP address is changing

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.