question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sock Shop deployed to Docker Swarm does not work

See original GitHub issue

The Problem

As someone reported on the Weave Users Slack group, the deployment with Docker Swarm is broken.

Here’s a screenshot of how it looks when trying to access the shop via the browser: swarm001

To reproduce the error one simply needs to follow our official guide to deploy the Sock Shop to Docker Swarm

Setting up Docker Swarm, bundling the shop with Docker Compose and deploying the service works good. It’s only during runtime that one gets this error.

Errors

When querying the catalogue service, this is the response:

$ curl http://localhost:30000/catalogue?size=5
{"message":"getaddrinfo ENOTFOUND catalogue catalogue:80","error":{"code":"ENOTFOUND","errno":"ENOTFOUND","syscall":"getaddrinfo","hostname":"catalogue","host":"catalogue","port":80}}

A similar error is returned for the cart service

$ curl http://localhost:30000/cart
{"message":"getaddrinfo ENOTFOUND carts carts:80","error":{"code":"ENOTFOUND","errno":"ENOTFOUND","syscall":"getaddrinfo","hostname":"carts","host":"carts","port":80}}

Specs

My system:

macOS Sierra 10.12.4
$ docker version
Client:
 Version:      17.03.1-ce
 API version:  1.27
 Go version:   go1.7.5
 Git commit:   c6d412e
 Built:        Tue Mar 28 00:40:02 2017
 OS/Arch:      darwin/amd64

Server:
 Version:      17.03.1-ce
 API version:  1.27 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   c6d412e
 Built:        Fri Mar 24 00:00:50 2017
 OS/Arch:      linux/amd64
 Experimental: true

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
patricksecommented, Jun 13, 2017

I´ve got the same behaviour with kubernetes… the carts and catalogue services can´t find their databases…


com.mongodb.MongoSocketException: carts-db: Try again
        at com.mongodb.ServerAddress.getSocketAddress(ServerAddress.java:188) ~[mongodb-driver-core-3.2.2.jar!/:na]
        at com.mongodb.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:50) ~[mongodb-driver-core-3.2.2.jar!/:na]
        at com.mongodb.connection.SocketStream.open(SocketStream.java:58) ~[mongodb-driver-core-3.2.2.jar!/:na]
        at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:114) ~[mongodb-driver-core-3.2.2.jar!/:na]
        at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:128) ~[mongodb-driver-core-3.2.2.jar!/:na]
        at java.lang.Thread.run(Thread.java:745) [na:1.8.0_111-internal]
Caused by: java.net.UnknownHostException: carts-db: Try again
        at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) ~[na:1.8.0_111-internal]
        at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928) ~[na:1.8.0_111-internal]
        at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323) ~[na:1.8.0_111-internal]
        at java.net.InetAddress.getAllByName0(InetAddress.java:1276) ~[na:1.8.0_111-internal]
        at java.net.InetAddress.getAllByName(InetAddress.java:1192) ~[na:1.8.0_111-internal]
        at java.net.InetAddress.getAllByName(InetAddress.java:1126) ~[na:1.8.0_111-internal]
        at java.net.InetAddress.getByName(InetAddress.java:1076) ~[na:1.8.0_111-internal]
        at com.mongodb.ServerAddress.getSocketAddress(ServerAddress.java:186) ~[mongodb-driver-core-3.2.2.jar!/:na]
        ... 5 common frames omitted
ts=2017-06-13T11:49:03Z caller=main.go:108 Error="Unable to connect to Database" DSN=catalogue_user:default_password@tcp(catalogue-db:3306)/socksdb
1reaction
keltik85commented, Apr 4, 2019

root@my-pc~# microk8s.enable dns made it work

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - Microservices Demo: Sock Shop
The easiest and fastest way to get started with the Sock Shop application is by using Docker Compose. If you don't have Docker...
Read more >
Docker swarm does not distribute the container in the cluster
I think the images are not accessible from a worker node, that is why they not receive containers, try to use this guide...
Read more >
The Sock Shop: Microservices from dev to prod with Docker ...
Your browser can 't play this video. ... Luke Marsden - The Sock Shop : Microservices from dev to prod with Docker and...
Read more >
Run Docker Engine in swarm mode
$ docker swarm init Swarm initialized: current node (dxn1zf6l61qsb1josjja83ngz) is now a manager. To add a worker to this swarm, run the following...
Read more >
Running Applications on a Docker Swarm Mode Cluster
In this tutorial you will learn how to define, deploy, and scale a multi-service application with Docker Swarm Mode.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found