Skip to content

When Multistage Build on Docker file " No Elastic Node Aviable " #810

Closed
@Navapon

Description

@Navapon

Using ElasticSearch Version

[ ] elastic.v6 (for Elasticsearch 6.1.2)

Please describe the expected behavior

Expect move binary file to small images && Can run normally

I'm wanna use Docker multistage build images with Olivere / elastic
but when I'm trying to move an executed go binary file from builder stage has to error
time=09-09-26068 09:09:00 level=error msg=no active connection found: no Elasticsearch node available host=045b4f45f939 layer=STORAGE model=NewElastic

But !! if i don't move execute file from builder stage just leave it in to builder container and delete seconds build stage this error is not happen i'm currious what i'm missing

Is this library require some lib. Below is my Dockerfile

FROM 3dsinteractive/go-librdkafka:v1 as builder
ADD ./api-consumer/ /go/

WORKDIR /go/src/pushandmotion.com/pushconsumer

RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh && \
    dep ensure && \
    go build -o /app/pushconsumer -tags static_all

#This can run normally
ENTRYPOINT ["/app/pushconsumer"]

EXPOSE 8000

#Promblem is happen when copy binary file from builder
FROM alpine:3.6
    
WORKDIR /root/
COPY --from=builder /app/pushconsumer .
ENTRYPOINT ["/root/pushconsumer"]

Please describe the actual behavior

When move execute file to small image has promble " No Elastic Node Aviable "

I'm already open elasticsearch in browser and ping inside the container it's work fine

Activity

olivere

olivere commented on Jun 26, 2018

@olivere
Owner

This doesn't have to do anything with Docker and/or multi-stage builds. It has to do something with the way sniffing works (see details in the Wiki). The node IPs are probably not accessible from your application.

Navapon

Navapon commented on Jun 26, 2018

@Navapon
Author

actually, my app can access the node I'm trying by exec in the container and curl to elastic directly

screen shot 2561-06-26 at 23 19 00

but when logging this error still happen

screen shot 2561-06-26 at 23 19 33

What i'm doing wrong cause it's work normal when i'm put build file on top image not second images

olivere

olivere commented on Jun 26, 2018

@olivere
Owner

Okay. When you enable sniffing, it will retrieve the node IPs from the http.publish_address. And that seems to be routeable, you're right.

Where does that msg=health check timeout: ... come from? Is that a prefix you use, or does it come from Elastic? Because that might actually mean that sniffing works, but health checks don't.

Can you try to disable health checks temporarily to see if that makes a difference?

olivere

olivere commented on Jul 11, 2018

@olivere
Owner

Any news here?

Navapon

Navapon commented on Jul 11, 2018

@Navapon
Author

Oh, my bad sorry for no response. After your suggestion, I'm disabled health checks its work fine

olivere

olivere commented on Jul 20, 2018

@olivere
Owner

@Navapon I have been trying to reproduce this with https://github.com/olivere/elastic-with-docker (now updated to work with ES 6.x), but I couldn't. Maybe you can try it with that repo, and I'll re-open here if you can get the bug there. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @olivere@Navapon

        Issue actions

          When Multistage Build on Docker file " No Elastic Node Aviable " · Issue #810 · olivere/elastic