Problem with Rancher Catalog / Docker-compose


I’m pretty new to rancher, sorry if I’m missing something important.

I tried to directly launch a stack for the catalog, e.g wordpress. Everything was running but couldn’t access wordpress on the browser. (Yes, net.ipv4.conf.all.forwarding is up)

So I did a basic docker file :

    image: mysql:5.7
      - "/home/test/db:/var/lib/mysql"
    restart: always
      MYSQL_ROOT_PASSWORD: wordpress
      MYSQL_DATABASE: wordpress
      MYSQL_USER: wordpress
      MYSQL_PASSWORD: wordpress
    image: wordpress:latest
      - db
      - "8000:80"
    restart: always
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_PASSWORD: wordpress

And try to run it with rancher stack (and adding this docker file). Everything running but still can’t access wordpress.

If I use docker-compose itself to generate this with the same file, it works and I can access wordpress website.

What am I missing ???

I had no issues running this in my own Rancher set up.

Do you have hosts set up in your Rancher environment that have port 8000 free?

Do teh containers come up?

Yeah port are free and in both case the containers are up and running.
Basically the thing is that if i’m running this through rancher and the stack option (Add stack, import docker-compose), it runs but can’t access it. And I checked on the stack, the containers are correctly linked…
If I directly use docker-compose to run this, it works and I can access wordpress site on 8000.

Well I just saw that the status is “unhealthy” on wordpress actually and if i see the log i got :

8/4/2016 9:28:20 PMMySQL Connection Error: (2002) php_network_getaddresses: getaddrinfo failed: Name or service not known

Rancher is renaming the name of the container with r-stackname_containerName does this may be the problem ?

Any clue on this ? I’m a bit disappointed that things out of the box doesn’t work btw, i’m using cattle.

I’m on my phone but doesn’t WordPress expect a separate variable for the port? I think you’re trying to resolve “db:3306” in DNS, which obviously fails… And vanilla docker-compose probably sets the link environment variables last, which overrides that one with just an IP, so it happens to work.

I don’t think so, not for the DB. I basically get the same error if I just create a wordpress stack from rancher catalog… It’s for sure a DNS issue but normally Cattle should directly write the proper dns records right ?