Logging from one Docker Container to Another
<p>When trying to connect two containers on my ubuntu 16.04 host, I can not send messages from one container to the other, while the adress is available at the host.</p>

<p>I started one container (which provides a syslog-service by <code>syslog-ng</code>) with:</p>

<pre><code>docker run -d -p 127.0.0.1:515:514/udp --name syslog-ng bobrik/syslog-ng
</code></pre>

<p>This container is defined in: <a href="https://github.com/bobrik/docker-syslog-ng" rel="nofollow noreferrer">https://github.com/bobrik/docker-syslog-ng</a> . According to <a href="https://www.balabit.com/documents/syslog-ng-ose-latest-guides/en/syslog-ng-ose-guide-admin/html/configuring-sources-network.html" rel="nofollow noreferrer">https://www.balabit.com/documents/syslog-ng-ose-latest-guides/en/syslog-ng-ose-guide-admin/html/configuring-sources-network.html</a> the <code>udp(ip(0.0.0.0), port(514));</code> in the syslog-ng.conf should make it possible to accept all ip-connections.</p>

<p>Now I can log from the host to the container using: </p>

<pre><code>logger -n 127.0.0.1 -P 515 test123
</code></pre>

<p>The second container was started with (one time with the <code>--link</code>, once without)</p>

<pre><code>docker run -it --link syslog-ng ubuntu /bin/bash
</code></pre>

<p>and in both cases, the logging is not available to the container, i.e.</p>

<pre><code>logger -n 127.0.0.3 -P 515
</code></pre>

<p>returns no error message, but no message is added to the log either. (Tried it also with 127.0.0.1 and syslog-ng in case of the linked container). </p>

<p>So the question is: Why is logging in the container not possible?</p>

<p>If I start another container, both are on the same network, <code>docker network inspect bridge</code> returns:</p>

<pre><code>[
    {
        "Name": "bridge",
        "Id": "6836c8a52555f30f27001daf9b111ad41a035a31783250e043c34602ea83cfe3",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "172.17.0.0/16",
                    "Gateway": "172.17.0.1"
                }
            ]
        },
        "Internal": false,
        "Containers": {
            "3acef55e018280571410b63b0cb7314ba354b67fb6523662b48ad09be8424423": {
                "Name": "syslog-ng",
                "EndpointID": "d6f2ad9cc9b5f6a5030e6061c4abb600ff7b0f16711f169954dd446f1351cb08",
                "MacAddress": "02:42:ac:11:00:03",
                "IPv4Address": "172.17.0.3/16",
                "IPv6Address": ""
            },
            "4f7d0101f97dca63b160e16a5e298c45f2ff51aa35085d0cdec96497a598be1a": {
                "Name": "goofy_lamarr",
                "EndpointID": "e357d6a99f67964bac4619d1ac984cd361a9c39137ea8d67a1ebc641e498919b",
                "MacAddress": "02:42:ac:11:00:05",
                "IPv4Address": "172.17.0.5/16",
                "IPv6Address": ""
            }
        },
        "Options": {
            "com.docker.network.bridge.default_bridge": "true",
            "com.docker.network.bridge.enable_icc": "true",
            "com.docker.network.bridge.enable_ip_masquerade": "true",
            "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
            "com.docker.network.bridge.name": "docker0",
            "com.docker.network.driver.mtu": "1500"
        },
        "Labels": {}
    }
]
</code></pre>

<p>This is <code>/etc/hosts</code> on the ubuntu container where I try to log:</p>

<pre><code>cat /etc/hosts 
127.0.0.1   localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.17.0.3  syslog-ng 3acef55e0182
172.17.0.5  4f7d0101f97d
</code></pre>

<p>So the syslog-ng should be available with syslog-ng or 172.17.0.3.</p>

<p>If I understood <a href="https://docs.docker.com/engine/userguide/networking/default_network/dockerlinks/" rel="nofollow noreferrer">https://docs.docker.com/engine/userguide/networking/default_network/dockerlinks/</a> correctly, than linking should make it possible to log directly to <code>syslog-ng</code>, and without the link, I should still be able to send messages from the one container to the container which exposed a port by ip, according to <a href="https://docs.docker.com/engine/userguide/networking/" rel="nofollow noreferrer">https://docs.docker.com/engine/userguide/networking/</a>. </p>

<p>It seems like this is the same as: <a href="https://stackoverflow.com/questions/29724275/logging-from-one-docker-container-to-another">Logging from one docker container to another</a>, but there are no concrete containers provided.</p>

<p>Has anyone an idea why this logging isn't possible?</p>