Links between service Rancher Server 1.0.0

时间:2016-04-04 17:03:58

标签: mysql wordpress docker rancher

I'm porting my docker environment to rancher server 1.0.0.

I have a wordpress container which is linked to a mysql container. Each one are in separate stack: One stack for the wordpress container and one for the mysql container.

Previously, linking between those two container was achieve using a docker-compose.yml for my wordpress container containing:

wordpress:  
    external_links:
        - mysql:mysql

This was working perfectly before, but not anymore when those containers are within a rancher server.

The documentation about DNS service is not clear for me: http://docs.rancher.com/rancher/rancher-services/internal-dns-service/

In rancher, my stack is named mysql and my service mysql.

I have tried to link using what

wordpress:
    external_links:
        - mysql.mysql:mysql

But this does not works too.

Those two containers are in a custom catalog, the only way right now to make this work is to create and start the two services and then change linking by upgrading the wordpress service afterward.

Any idea ? I'm i missing something ?

Thanks a lots !

1 个答案:

答案 0 :(得分:1)

以下是解决方案:

而不是:

    external_links:
        - mysql.mysql:mysql

使用以下语法链接堆栈中的服务:

    external_links:
        - mysql/mysql:mysql

或者更一般地说:

    external_links:
        - stack_name/service_name:alias_name

希望这有帮助!