pblittle / docker-logstash

Docker image for Logstash 1.4
https://hub.docker.com/r/pblittle/docker-logstash
MIT License
236 stars 90 forks source link

Can not connect to linked ES 1.4.4 container #65

Closed mikehaertl closed 3 years ago

mikehaertl commented 9 years ago

As i want to try out Kibana4, i've set up a linked container from the official elasticasearch image. Here's the fig.yml

elastic:
    image: elasticsearch:1.4.4
    ports:
        - "9200:9200"
        - "9300:9300"
    expose:
        - "9200"
        - "9300"
logstash:
    image: pblittle/docker-logstash:latest
    volumes:
            - ./logstash/:/opt/logstash/conf.d
            - ./logs/:/logdata/
    links:
        - elastic:es
    ports:
        - "9292:9292"

The config in logstash/logstash.conf is:

input {
    file {
        path => "/logdata/apache.log"
    }
}
filter {
    grok {
        match => { "message" => "%{COMBINEDAPACHELOG}" }
    }
    date {
        match => [ "timestamp" , "dd/MMM/yyyy:HH:mm:ss Z" ]
        timezone => "Europe/Berlin"
        locale => "en"
    }
}
output {
    stdout {
        codec => rubydebug
    }
    elasticsearch {
        bind_host => "172.17.0.82"
        port => "tcp://172.17.0.82:9200"
        index => "apache-logs"
        index_type => "apache"
    }
}

Note: I had ES_HOST and ES_PORT there before and it got replaced with the IP address.

When I try to start that setup with fig up I get this error:

logstash_1 | converted 'https://gist.githubusercontent.com/pblittle/8994708/raw/insecure-logstash-forwarder.key' (ANSI_X3.4-1968) -> 'https://gist.githubusercontent.com/pblittle/8994708/raw/insecure-
logstash-forwarder.key' (UTF-8)
logstash_1 | --2015-02-24 19:46:39--  https://gist.githubusercontent.com/pblittle/8994708/raw/insecure-logstash-forwarder.key
logstash_1 | Resolving gist.githubusercontent.com (gist.githubusercontent.com)... 185.31.18.133
elastic_1  | [2015-02-24 19:46:39,304][INFO ][node                     ] [Yeti] version[1.4.4], pid[1], build[c88f77f/2015-02-19T13:05:36Z]
elastic_1  | [2015-02-24 19:46:39,305][INFO ][node                     ] [Yeti] initializing ...
elastic_1  | [2015-02-24 19:46:39,311][INFO ][plugins                  ] [Yeti] loaded [], sites []
logstash_1 | Connecting to gist.githubusercontent.com (gist.githubusercontent.com)|185.31.18.133|:443... connected.
logstash_1 | HTTP request sent, awaiting response... 200 OK
logstash_1 | Length: 1674 (1.6K) [text/plain]
logstash_1 | Saving to: '/opt/ssl/logstash-forwarder.key'
logstash_1 | 
logstash_1 |      0K .                                                     100% 45.1M=0s
logstash_1 | 
logstash_1 | 2015-02-24 19:46:39 (45.1 MB/s) - '/opt/ssl/logstash-forwarder.key' saved [1674/1674]
logstash_1 | 
logstash_1 | converted 'https://gist.githubusercontent.com/pblittle/8994726/raw/insecure-logstash-forwarder.crt' (ANSI_X3.4-1968) -> 'https://gist.githubusercontent.com/pblittle/8994726/raw/insecure-
logstash-forwarder.crt' (UTF-8)
logstash_1 | --2015-02-24 19:46:39--  https://gist.githubusercontent.com/pblittle/8994726/raw/insecure-logstash-forwarder.crt
logstash_1 | Resolving gist.githubusercontent.com (gist.githubusercontent.com)... 185.31.18.133
logstash_1 | Connecting to gist.githubusercontent.com (gist.githubusercontent.com)|185.31.18.133|:443... connected.
logstash_1 | HTTP request sent, awaiting response... 200 OK
logstash_1 | Length: 1345 (1.3K) [text/plain]
logstash_1 | Saving to: '/opt/ssl/logstash-forwarder.crt'
logstash_1 | 
logstash_1 |      0K .                                                     100% 41.6M=0s
logstash_1 | 
logstash_1 | 2015-02-24 19:46:39 (41.6 MB/s) - '/opt/ssl/logstash-forwarder.crt' saved [1345/1345]
logstash_1 | 
elastic_1  | [2015-02-24 19:46:42,860][INFO ][node                     ] [Yeti] initialized
elastic_1  | [2015-02-24 19:46:42,863][INFO ][node                     ] [Yeti] starting ...
elastic_1  | [2015-02-24 19:46:43,203][INFO ][transport                ] [Yeti] bound_address {inet[/0:0:0:0:0:0:0:0:9300]}, publish_address {inet[/172.17.0.82:9300]}
elastic_1  | [2015-02-24 19:46:43,309][INFO ][discovery                ] [Yeti] elasticsearch/7un8650wSY2F5D18PYQXMg
elastic_1  | [2015-02-24 19:46:47,132][INFO ][cluster.service          ] [Yeti] new_master [Yeti][7un8650wSY2F5D18PYQXMg][362c20a41593][inet[/172.17.0.82:9300]], reason: zen-disco-join (elected_as_ma
ster)
elastic_1  | [2015-02-24 19:46:47,234][INFO ][http                     ] [Yeti] bound_address {inet[/0:0:0:0:0:0:0:0:9200]}, publish_address {inet[/172.17.0.82:9200]}
elastic_1  | [2015-02-24 19:46:47,234][INFO ][node                     ] [Yeti] started
elastic_1  | [2015-02-24 19:46:47,238][INFO ][gateway                  ] [Yeti] recovered [0] indices into cluster_state
logstash_1 | Sending logstash logs to /var/log/logstash/logstash.log.
logstash_1 | Exception in thread ">output" org.elasticsearch.transport.BindTransportException: Failed to bind to [9300-9400]
logstash_1 |    at org.elasticsearch.transport.netty.NettyTransport.doStart(org/elasticsearch/transport/netty/NettyTransport.java:380)
logstash_1 |    at org.elasticsearch.common.component.AbstractLifecycleComponent.start(org/elasticsearch/common/component/AbstractLifecycleComponent.java:85)
logstash_1 |    at org.elasticsearch.transport.TransportService.doStart(org/elasticsearch/transport/TransportService.java:92)
logstash_1 |    at org.elasticsearch.common.component.AbstractLifecycleComponent.start(org/elasticsearch/common/component/AbstractLifecycleComponent.java:85)
logstash_1 |    at org.elasticsearch.node.internal.InternalNode.start(org/elasticsearch/node/internal/InternalNode.java:229)
logstash_1 |    at org.elasticsearch.node.NodeBuilder.node(org/elasticsearch/node/NodeBuilder.java:166)
logstash_1 |    at java.lang.reflect.Method.invoke(java/lang/reflect/Method.java:606)
logstash_1 |    at RUBY.build_client(/opt/logstash/lib/logstash/outputs/elasticsearch/protocol.rb:198)
logstash_1 |    at RUBY.client(/opt/logstash/lib/logstash/outputs/elasticsearch/protocol.rb:15)
logstash_1 |    at RUBY.initialize(/opt/logstash/lib/logstash/outputs/elasticsearch/protocol.rb:157)
logstash_1 |    at RUBY.register(/opt/logstash/lib/logstash/outputs/elasticsearch.rb:250)
logstash_1 |    at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1613)
logstash_1 |    at RUBY.outputworker(/opt/logstash/lib/logstash/pipeline.rb:220)
logstash_1 |    at RUBY.start_outputs(/opt/logstash/lib/logstash/pipeline.rb:152)
logstash_1 |    at java.lang.Thread.run(java/lang/Thread.java:745)
logstash_1 | Caused by: org.elasticsearch.common.netty.channel.ChannelException: Failed to bind to: /172.17.0.82:9400
logstash_1 |    at org.elasticsearch.common.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:272)
logstash_1 |    at org.elasticsearch.transport.netty.NettyTransport$3.onPortNumber(NettyTransport.java:371)
logstash_1 |    at org.elasticsearch.common.transport.PortsRange.iterate(PortsRange.java:69)
logstash_1 |    at org.elasticsearch.transport.netty.NettyTransport.doStart(NettyTransport.java:367)
logstash_1 |    at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:85)
logstash_1 |    at org.elasticsearch.transport.TransportService.doStart(TransportService.java:92)
logstash_1 |    at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:85)
logstash_1 |    at org.elasticsearch.node.internal.InternalNode.start(InternalNode.java:229)
logstash_1 |    at org.elasticsearch.node.NodeBuilder.node(NodeBuilder.java:166)
logstash_1 |    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
logstash_1 |    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
logstash_1 |    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
logstash_1 |    at java.lang.reflect.Method.invoke(Method.java:606)
logstash_1 |    at org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(JavaMethod.java:440)
logstash_1 |    at org.jruby.javasupport.JavaMethod.invokeDirect(JavaMethod.java:304)
logstash_1 |    at org.jruby.java.invokers.InstanceMethodInvoker.call(InstanceMethodInvoker.java:52)
logstash_1 |    at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:306)
logstash_1 |    at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:136)
logstash_1 |    at org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:60)
logstash_1 |    at org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:60)
logstash_1 |    at org.jruby.ast.ReturnNode.interpret(ReturnNode.java:92)
logstash_1 |    at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
logstash_1 |    at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
logstash_1 |    at org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
logstash_1 |    at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
logstash_1 |    at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:198)
logstash_1 |    at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:326)
logstash_1 |    at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
logstash_1 |    at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
logstash_1 |    at org.jruby.ast.InstAsgnNode.interpret(InstAsgnNode.java:95)
logstash_1 |    at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
logstash_1 |    at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
logstash_1 |    at org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
logstash_1 |    at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:139)
logstash_1 |    at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:182)
logstash_1 |    at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:306)
logstash_1 |    at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:136)
logstash_1 |    at org.jruby.ast.VCallNode.interpret(VCallNode.java:88)
logstash_1 |    at org.jruby.ast.InstAsgnNode.interpret(InstAsgnNode.java:95)
logstash_1 |    at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
logstash_1 |    at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
logstash_1 |    at org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
logstash_1 |    at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:204)
logstash_1 |    at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:206)
logstash_1 |    at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:336)
logstash_1 |    at org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:179)
logstash_1 |    at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:183)
logstash_1 |    at org.jruby.RubyClass.newInstance(RubyClass.java:804)
logstash_1 |    at org.jruby.RubyClass$INVOKER$i$newInstance.call(RubyClass$INVOKER$i$newInstance.gen)
logstash_1 |    at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroOrOneOrNBlock.call(JavaMethod.java:297)
logstash_1 |    at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:326)
logstash_1 |    at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
logstash_1 |    at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
logstash_1 |    at org.jruby.ast.InstAsgnNode.interpret(InstAsgnNode.java:95)
logstash_1 |    at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
logstash_1 |    at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
logstash_1 |    at org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
logstash_1 |    at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:112)
logstash_1 |    at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:164)
logstash_1 |    at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:286)
logstash_1 |    at org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:81)
logstash_1 |    at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:85)
logstash_1 |    at org.jruby.RubySymbol$1.yieldInner(RubySymbol.java:445)
logstash_1 |    at org.jruby.RubySymbol$1.yield(RubySymbol.java:465)
logstash_1 |    at org.jruby.runtime.Block.yield(Block.java:142)
logstash_1 |    at org.jruby.RubyArray.eachCommon(RubyArray.java:1606)
logstash_1 |    at org.jruby.RubyArray.each(RubyArray.java:1613)
logstash_1 |    at org.jruby.RubyArray$INVOKER$i$0$0$each.call(RubyArray$INVOKER$i$0$0$each.gen)
logstash_1 |    at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:316)
logstash_1 |    at org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:145)
logstash_1 |    at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:149)
logstash_1 |    at org.jruby.ast.CallNoArgBlockPassNode.interpret(CallNoArgBlockPassNode.java:53)
logstash_1 |    at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
logstash_1 |    at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
logstash_1 |    at org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
logstash_1 |    at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:139)
logstash_1 |    at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:182)
logstash_1 |    at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:306)
logstash_1 |    at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:136)
logstash_1 |    at org.jruby.ast.VCallNode.interpret(VCallNode.java:88)
logstash_1 |    at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
logstash_1 |    at org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)
logstash_1 |    at org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:206)
logstash_1 |    at org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:194)
logstash_1 |    at org.jruby.runtime.Interpreted19Block.call(Interpreted19Block.java:125)
logstash_1 |    at org.jruby.runtime.Block.call(Block.java:101)
logstash_1 |    at org.jruby.RubyProc.call(RubyProc.java:290)
logstash_1 |    at org.jruby.RubyProc.call(RubyProc.java:228)
logstash_1 |    at org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:99)
logstash_1 |    at java.lang.Thread.run(Thread.java:745)
logstash_1 | Caused by: java.net.BindException: Cannot assign requested address
logstash_1 |    at sun.nio.ch.Net.bind0(Native Method)
logstash_1 |    at sun.nio.ch.Net.bind(Net.java:444)
logstash_1 |    at sun.nio.ch.Net.bind(Net.java:436)
logstash_1 |    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)
logstash_1 |    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
logstash_1 |    at org.elasticsearch.common.netty.channel.socket.nio.NioServerBoss$RegisterTask.run(NioServerBoss.java:193)
logstash_1 |    at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.processTaskQueue(AbstractNioSelector.java:372)
logstash_1 |    at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:296)
logstash_1 |    at org.elasticsearch.common.netty.channel.socket.nio.NioServerBoss.run(NioServerBoss.java:42)
logstash_1 |    at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
logstash_1 |    at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
logstash_1 |    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
logstash_1 |    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
logstash_1 |    ... 1 more

The IP address is correct and I can connect to the ES server from inside the logstash container:

$ docker exec -ti elk_logstash_1 bash
root@02157a47625d:/# echo $ES_PORT_9200_TCP_ADDR
172.17.0.82
root@02157a47625d:/# curl http://172.17.0.82:9200
{
  "status" : 200,
  "name" : "Yeti",
  "cluster_name" : "elasticsearch",
  "version" : {
    "number" : "1.4.4",
    "build_hash" : "c88f77ffc81301dfa9dfd81ca2232f09588bd512",
    "build_timestamp" : "2015-02-19T13:05:36Z",
    "build_snapshot" : false,
    "lucene_version" : "4.10.3"
  },
  "tagline" : "You Know, for Search"
}
pblittle commented 9 years ago

@mikehaertl do you mind turning tracing on in the logstash section of your fig.yml?

logstash:
  environment:
    LOGSTASH_TRACE: true

From there, please run again and either drop the relevant info either in here or in a gist. I think this issue is similar to what @systemfreund reported in issue #59.

mikehaertl commented 9 years ago

Sure, here's the gist: https://gist.github.com/mikehaertl/954952e09ead26f7baf4

BTW since the config vars ES_HOST and ES_PORT get overwritten in my local config, I have to reset them to those vars each time i restart the setup (otherwhise it would use the wrong IP as containers get new IPs if they are recreated). Is there a way to avoid that?

pblittle commented 9 years ago

@mikehaertl thanks for the gist. Are you manually setting the port => "tcp://172.17.0.82:9200" in your logstash.conf? If you are, that should only be a port, port => "9200".

I'm writing some tests now based on your fig.yml. I should have them ready at some point today.

pblittle commented 9 years ago

@mikehaertl I think that I have your issue sorted out. The problem was that the ES_HOST variable that I was using is also being set by Docker when you have a linked container. That's what @systemfreund's issue #59 found.

In the fix I just made, there are now separate env variables available for the Elasticsearch service:

https://github.com/pblittle/docker-logstash/blob/hotfix/elasticsearch-port-fix/1.4/base/elasticsearch.sh#L11-L31

# If there is a linked Elasticsearch container, use it's host.
# If there isn't a link, use ES_SERVICE_HOST if it is defined.
# Otherwise fall back to 127.0.0.1.
#
function es_service_host() {
    local default_host=${ES_SERVICE_HOST:-127.0.0.1}
    local host=${ES_PORT_9200_TCP_ADDR:-$default_host}

    echo "$host"
}

# If there is a linked Elasticsearch container, use it's port.
# If there isn't a link, use ES_SERVICE_PORT if it is defined.
# Otherwise fall back to 9200.
#
function es_service_port() {
    local default_port=${ES_SERVICE_PORT:-9200}
    local port=${ES_PORT_9200_TCP_PORT:-$default_port}

    echo "$port"
}

And the Elasticsearch proxy used by Kibana:

https://github.com/pblittle/docker-logstash/blob/hotfix/elasticsearch-port-fix/1.4/base/kibana.sh#L11-L21

function es_proxy_host() {
    local host=${ES_PROXY_HOST:-'"+window.location.hostname+"'}

    echo "$host"
}

function es_proxy_port() {
    local port=${ES_PROXY_PORT:-9200}

    echo "$port"
}

I have also beefed up the test suite to cover the edge cases that are starting to crop up. The implementation is basic now. There is an embedded test and a linked test. The linked test is based on this issue.

I am going to merge the fix in soon. If you happen to have time, please give the hotfix/elasticsearch-port-fix branch a try.

mikehaertl commented 9 years ago

I'm not at my test machine right now, but only that much: The ES_* vars are set because of this setting in the fig.yml:

    links:
        - elastic:es

This was taken from your example for linked containers:

$ docker run -d \
  --link <your_es_container_name>:es \
  -p 9292:9292 \
  pblittle/docker-logstash

We could simply remove the es alias, if it's not required.

pblittle commented 9 years ago

@mikehaertl the es alias is used throughout the codebase. It can be renamed (see the second note below), but it will break existing installations of this container.

Unless I'm missing a third option, to fix this issue, I am going to have to decide between two potentially breaking changes to resolve the variable name conflict:

  1. Change the ES_HOST & ES_PORT environment variables to ES_SERVICE_HOST & ES_SERVICE_PORT as I did in this PR.
  2. Rename the es link name that creates the ES_* environment variables as you noted.

The ES_HOST & ES_PORT placeholders used for config file interpolation will continue to work regardless.

I would love to find a third option that doesn't break any existing implementations.

mikehaertl commented 9 years ago

Sorry if I missed it, but how is this fixed now? I'm now using pblittle/docker-logstash:0.12.1.

I still set this in my customer logstash.conf:

output {
    stdout {
        codec => rubydebug
    }
    elasticsearch {
        bind_host => "ES_HOST"
        port => "ES_PORT"
        index => "apache-logs"
        index_type => "apache"
    }
}

I get the same error as before. Afterwards the variables in the logfile are replaced:

output {
    stdout {
        codec => rubydebug
    }
    elasticsearch {
        bind_host => "172.17.0.11"
        port => "9200"
        index => "apache-logs"
        index_type => "apache"
    }
}

Apart from it still not working, I still have the problem, that I always have to restore the ES_HOST and ES_PORT variables in my custom config whenever I restart the machines. So somehow this replacement approach isn't very userfriendly really. Maybe there's a better way?

griff commented 9 years ago

Since docker will write a mapping of the ip address to the linked alias into /etc/hosts it is prefered to used that (in this case by using the hostname es) instead of environment variables like ES_PORT_9200_TCP_ADDR because while the /etc/hosts file gets updated on restart of the linked container the environment variables wont get updated (see docker/docker#9891).

pblittle commented 9 years ago

@griff, thanks for bringing this issue back to life. Revisiting it was on my todo list. @mikehaertl, sorry to leave you hanging. :smile:

I wish I had more time to follow the Docker issue tracker. I totally missed the issue and related documentation. I would imagine this oversight in my image impacts a lot of folks.

@mikehaertl do you think this approach would solve your issue?

mikehaertl commented 9 years ago

@pblittle No worries - I had no time either :D. I think I've tried the hostname before and it didn't work - but I may be wrong. Will test again when I find time.

Tazer commented 9 years ago

Any updates to this issue ? :)

pblittle commented 9 years ago

@Tazer, sorry I haven't gotten back to you yet. The short answer is no, I don't have any updates. :) I take it you are experiencing the issue also? Is there anything you can add to the comments above? Any information specific to your deployment would help.