I am trying out rancher by creating a MEAN stack following the simple example found here:
As you can see, only two simple images are required - mongo and linnovate/mean. The mean container requires a link to the mongodb container using the name “db”.
I created a simple docker-composer.yml file to test this locally first using CLI and it works as expected. I can access http://<host_ipaddr>:3000 and see the meanio default page.
Here’s the file content:
mongodb: image: mongo:latest meanio: ports: - 3000:3000/tcp image: linnovate/mean:latest #depends_on: # - mongodb links: - mongodb:db tty: true stdin_open: true
However, when I tried to create a stack in rancher using this same docker-compose.yml file, the services do not seem to work. Each service only has one container as expected. The meanio container is not able to use the “db” link to connect to the mongodb container. You will see a connection timeout error message from the meanio container logs after a while. The auto-generated container name obviously would not be “mongodb” - but I should be hardcoding the docker-compose.yml references to the generated name.
What am I missing?
I used the sample Wordpress stack from the catalog and it works fine. There is a similar dependency from the wordpress container to the mysql container in this Wordpress stack. Here, it is not using the auto-generated conatiner name as the link reference.