# JSON Unmarshaling error when using external links & rancher-compose

**URL:** <https://forums.suse.com/t/json-unmarshaling-error-when-using-external-links-rancher-compose/688>\
**Category:** Rancher 1.x\
**Created:** [October 12, 2015, 9:34pm UTC](https://forums.suse.com/t/json-unmarshaling-error-when-using-external-links-rancher-compose/688 "2015-10-12T21:34:59Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lovecannon](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/lovecannon/32/208_2.png) [@Lovecannon](https://forums.suse.com/u/Lovecannon)\
**Post date:** [October 12, 2015, 9:34pm UTC](https://forums.suse.com/t/json-unmarshaling-error-when-using-external-links-rancher-compose/688/1 "2015-10-12T21:34:59Z")

</div>

Hello everyone, ran into a weird issue with rancher-compose when i’m trying to use cross-stack linking.

In my default stack (which has been renamed to ‘Main’), I have a database. I have an image in another stack that will be linking to that database.

This is the docker compose file Im using:

```
wordpress:

  image: 192.168.201.110:5000/wrl/nginx-php-cache:latest
  expose:
    - "80"
  restart: always
  links:
    - memcached
  external_links:
    - Main/MariaDB:mysql
  volumes:
    - /sites/prod/wrladv.com/current/app:/var/www/app:rw
  entrypoint: /sbin/my_init
memcached:
  image: memcached:latest
  restart: always
  mem_limit: 128000000
  expose:
    - "11211"

```

This is the error it gives:

```
ERRO[0002] Failed Starting wordpress : json: cannot unmarshal number into Go value of type string 
ERRO[0002] Failed to start: wordpress : json: cannot unmarshal number into Go value of type string 
FATA[0002] json: cannot unmarshal number into Go value of type string 

```

If I remove the external link and use rancher-compose it starts up fine. Then I can add the external link through the UI to get it to work. Anybody know why it is giving me the marshaling error?

---

<div class="post-metadata">

**Author:** ![kaos](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/kaos/32/38_2.png) [@kaos](https://forums.suse.com/u/kaos)\
**Post date:** [October 13, 2015, 6:04am UTC](https://forums.suse.com/t/json-unmarshaling-error-when-using-external-links-rancher-compose/688/2 "2015-10-13T06:04:17Z")

</div>

This is a quoted vs unquoted issue. Probably the value of `mem_limit` that needs to be a string value… so try wrapping the `128000000` in quotes…

If that doesn’t help, look for other numbers (possibly in quotes) and add (or remove) the quotes to see if it helps.

---

<div class="post-metadata">

**Author:** ![Lovecannon](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/lovecannon/32/208_2.png) [@Lovecannon](https://forums.suse.com/u/Lovecannon)\
**Post date:** [October 13, 2015, 12:33pm UTC](https://forums.suse.com/t/json-unmarshaling-error-when-using-external-links-rancher-compose/688/3 "2015-10-13T12:33:20Z")

</div>

I originally thought it was an issue needing quotes, but it’s not. I’ve tried quoting all numbers, but that doesn’t help. It ONLY occurs when I have the external\_links defined, and it also doesn’t occur right away. It will try to start the services but around 10 seconds into the process is when it fails. Normally when the YAML is messed up rancher-compose won’t even run. If I remove the external\_links definition it has no issues and sets the mem\_limit correctly using the integer.

I’m pretty sure the unmarshaling error is occuring when it decodes a JSON response from the API server.

---

<div class="post-metadata">

**Author:** ![kaos](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/kaos/32/38_2.png) [@kaos](https://forums.suse.com/u/kaos)\
**Post date:** [October 13, 2015, 1:38pm UTC](https://forums.suse.com/t/json-unmarshaling-error-when-using-external-links-rancher-compose/688/4 "2015-10-13T13:38:50Z")

</div>

Well that is indeed weird. How’s the quoting in the Main stack?

---

<div class="post-metadata">

**Author:** ![Lovecannon](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/lovecannon/32/208_2.png) [@Lovecannon](https://forums.suse.com/u/Lovecannon)\
**Post date:** [October 13, 2015, 1:58pm UTC](https://forums.suse.com/t/json-unmarshaling-error-when-using-external-links-rancher-compose/688/5 "2015-10-13T13:58:47Z")

</div>

The Main stack is the default stack created by Rancher, just renamed to Main. All of the services in that stack are created through the UI. I haven’t had any issues before with linking, and it only seems to happen with an external link. I did use the external\_links feature correctly, right? I couldn’t find a ton of docs on it other than a mention in the load balancer section.

---

<div class="post-metadata">

**Author:** ![kaos](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/kaos/32/38_2.png) [@kaos](https://forums.suse.com/u/kaos)\
**Post date:** [October 13, 2015, 2:00pm UTC](https://forums.suse.com/t/json-unmarshaling-error-when-using-external-links-rancher-compose/688/6 "2015-10-13T14:00:26Z")

</div>

No, it looks right. Beats me, I’ll leave it for the experts 😄

---

<div class="post-metadata">

**Author:** ![Lovecannon](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/lovecannon/32/208_2.png) [@Lovecannon](https://forums.suse.com/u/Lovecannon)\
**Post date:** [October 14, 2015, 11:59am UTC](https://forums.suse.com/t/json-unmarshaling-error-when-using-external-links-rancher-compose/688/7 "2015-10-14T11:59:07Z")

</div>

Alena, any idea why this is happening?

---

<div class="post-metadata">

**Author:** ![denise](https://avatars.discourse-cdn.com/v4/letter/d/82dd89/32.png) [@denise](https://forums.suse.com/u/denise)\
**Post date:** [October 14, 2015, 4:37pm UTC](https://forums.suse.com/t/json-unmarshaling-error-when-using-external-links-rancher-compose/688/8 "2015-10-14T16:37:56Z")

</div>

Is there an equivalent `rancher-compose.yml` and could I also get the `docker-compose.yml` for the `Main` stack? I will try to reproduce in the next day or two.

---

<div class="post-metadata">

**Author:** ![Lovecannon](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/lovecannon/32/208_2.png) [@Lovecannon](https://forums.suse.com/u/Lovecannon)\
**Post date:** [October 14, 2015, 7:10pm UTC](https://forums.suse.com/t/json-unmarshaling-error-when-using-external-links-rancher-compose/688/9 "2015-10-14T19:10:38Z")

</div>

I didn’t use a rancher-compose file for the stack with wordpress. Also I don’t have a docker-compose file for Main stack, as I am not using rancher-compose for that stack.

---

<div class="post-metadata">

**Author:** ![Lovecannon](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/lovecannon/32/208_2.png) [@Lovecannon](https://forums.suse.com/u/Lovecannon)\
**Post date:** [October 14, 2015, 7:28pm UTC](https://forums.suse.com/t/json-unmarshaling-error-when-using-external-links-rancher-compose/688/10 "2015-10-14T19:28:19Z")

</div>

No, I did not use a rancher-compose file for the stack with the external\_links. As for the ‘Main’ stack I created that one through the UI so I do not have a docker-compose file for that stack.

If it’d help I can allow your github account to access my UI temporarily.

---

<div class="post-metadata">

**Author:** ![kaos](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/kaos/32/38_2.png) [@kaos](https://forums.suse.com/u/kaos)\
**Post date:** [October 14, 2015, 8:19pm UTC](https://forums.suse.com/t/json-unmarshaling-error-when-using-external-links-rancher-compose/688/11 "2015-10-14T20:19:58Z")

</div>

If you click on the stack name, there are a number of buttons, where the right-most one is to get the compose files for your stack.

 ![](https://us1.discourse-cdn.com/flex022/uploads/suse/original/1X/dac235aa0e4db6b243de44e9c4f32a6b5717f2a7.png)

---

<div class="post-metadata">

**Author:** ![Lovecannon](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/lovecannon/32/208_2.png) [@Lovecannon](https://forums.suse.com/u/Lovecannon)\
**Post date:** [October 14, 2015, 8:37pm UTC](https://forums.suse.com/t/json-unmarshaling-error-when-using-external-links-rancher-compose/688/12 "2015-10-14T20:37:06Z")

</div>

Never noticed that before. Anyway here is the docker-compose file:

```
MainLB-SSL:
  ports:
  - 443:443
  - 80:80
  restart: always
  external_links:
  - hammond-dev-site/wordpress:wordpress
  - loveandrew-dev-wrlweb-com/wordpress:wordpress
  - nolan-dev-wrlweb-com/wordpress:wordpress
  - loveandrew-prod-site/wordpress:wordpress
  - wrl-wp-production/wordpress:wordpress
  - conceptservices-production/wordpress:wordpress
  - hammond-production-site/wordpress:wordpress
  labels:
    io.rancher.loadbalancer.target.ImageServer-Rhonda: images.dev.wrlweb.com
    io.rancher.loadbalancer.target.loveandrew-prod-site/wordpress: loveandrew.org,www.loveandrew.com
    io.rancher.scheduler.global: 'true'
    io.rancher.loadbalancer.ssl.ports: '443'
    io.rancher.loadbalancer.target.nolan-dev-wrlweb-com/wordpress: nolan.dev.wrlweb.com
    io.rancher.loadbalancer.target.hammond-dev-site/wordpress: hammond.dev.wrlweb.com
    io.rancher.loadbalancer.target.hammond-production-site/wordpress: hammondconstruction.com,www.hammondconstruction.com
    io.rancher.loadbalancer.target.wrl-wp-production/wordpress: wrladv.com,www.wrladv.com
    io.rancher.loadbalancer.target.conceptservices-production/wordpress: conceptservicesltd.com,www.conceptservicesltd.com,concept.dev.wrlweb.com
    io.rancher.loadbalancer.target.loveandrew-dev-wrlweb-com/wordpress: loveandrew.dev.wrlweb.com
    io.rancher.loadbalancer.target.PHPMyAdmin: phpmyadmin.dev.wrlweb.com
  tty: true
  image: rancher/load-balancer-service
  links:
  - ImageServer-Rhonda:ImageServer-Rhonda
  - PHPMyAdmin:PHPMyAdmin
  stdin_open: true
ImageServer-Rhonda:
  restart: always
  tty: true
  image: 192.168.201.110:5000/wrl/nginx-static:latest
  volumes:
  - /sites/prod/imageserver:/var/www/app
  stdin_open: true
PHPMyAdmin:
  ports:
  - 80/tcp
  restart: always
  tty: true
  image: nazarpc/phpmyadmin
  links:
  - MariaDB-Master:mysql
  stdin_open: true
MariaDB-Master:
  ports:
  - 3306/tcp
  restart: always
  environment:
    MYSQL_ROOT_PASSWORD: [redacted]
  tty: true
  image: 192.168.201.110:5000/wrl/mariadb:latest
  volumes:
  - /data/db/mariadb-master:/var/lib/mysql:rw
  - /backup/db/mariadb-master:/data/backup/db:rw
  stdin_open: true

```

And the rancher-compose file:

```
MainLB-SSL:
  load_balancer_config:
    lb_cookie_stickiness_policy:
      cookie: haproxy_sticky
      domain: ''
    description: Main load balancer
    name: MainLB-SSL config
  default_cert: wrlweb.com
ImageServer-Rhonda:
  scale: 1
PHPMyAdmin:
  scale: 1
MariaDB-Master:
  scale: 1

```

* * *

---

<div class="post-metadata">

**Author:** ![denise](https://avatars.discourse-cdn.com/v4/letter/d/82dd89/32.png) [@denise](https://forums.suse.com/u/denise)\
**Post date:** [October 15, 2015, 8:48pm UTC](https://forums.suse.com/t/json-unmarshaling-error-when-using-external-links-rancher-compose/688/13 "2015-10-15T20:48:13Z")

</div>

What version of Rancher-compose are you using? Can you do a `rancher-compose -v`? Also, what version of Rancher are you running?

One thing that’s weird is that in your original post you are linking to `Main/MariaDB:mysql`, but in your docker-compose.yml of your `Main` stack, it’s called `MariaDB-Master`.

Also, you might find this issue on Expose relevant. Basically, rancher-compose ignores “Expose”. There was an issue with expose in previous rancher-compose release. The latest version (v0.4.1) has a fix.

> <https://github.com/rancher/rancher/issues/2198>
>
> Rancher v0.39.0
> Cattle v0.95.0
> User Interface v0.52.0
> Rancher Compose beta/latest
> Here is the YAML file I'm using to create a stack:
> test:
> restart: always
> tty: true
> ...

---

<div class="post-metadata">

**Author:** ![Lovecannon](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/lovecannon/32/208_2.png) [@Lovecannon](https://forums.suse.com/u/Lovecannon)\
**Post date:** [October 16, 2015, 1:54pm UTC](https://forums.suse.com/t/json-unmarshaling-error-when-using-external-links-rancher-compose/688/14 "2015-10-16T13:54:15Z")

</div>

Yeah, I copied the wrong YAML file. I actually referenced MariaDB-Master in the YAML file Ive been trying to use. I had thought before that the dashes were messing it up so I copied MariaDB-Master into another container called MariaDB and tried using that to no avail.

When I originally posted this thread I was using rancher-compose 0.4.0 but I upgraded the other day to 0.4.1 and it still gives the marshaling error.

---

<div class="post-metadata">

**Author:** ![denise](https://avatars.discourse-cdn.com/v4/letter/d/82dd89/32.png) [@denise](https://forums.suse.com/u/denise)\
**Post date:** [October 19, 2015, 5:14pm UTC](https://forums.suse.com/t/json-unmarshaling-error-when-using-external-links-rancher-compose/688/15 "2015-10-19T17:14:21Z")

</div>

This issue should be fixed in the next release of Rancher-compose, which should come out this week.

> <https://github.com/rancher/rancher/issues/2340>
>
> Currently only environment interpolation is allowed on docker-compose.yml, but does not work on rancher-compose.yml.
