Skip to content

Wider-world-to-container doesn't apply to traffic coming from within a container #277

Description

@pitkley

Scenario:

  1. Create a container providing some service under a non-published port, e.g. with the following docker-compose.yml:

    version: '2'
    
    services:
        whoami:
            image: containous/whoami:latest
            command: "--port 8081"

    Start the service using docker-compose --project-name whoami up -d.

  2. Add the following to your WWTC-configuration:

    [[wider_world_to_container.rules]]
    network = "whoami_default"
    dst_container = "whoami_whoami_1"
    expose_port = "8081/tcp"
  3. Signal DFW to reapply the rules (e.g. by restarting it).

  4. Try to cURL the above container from within another container on the same host:

    # docker container run --rm curlimages/curl -v http://<your host or IP>:8081
    Status: Downloaded newer image for curlimages/curl:latest
    *   Trying <IP>:8081...
    * connect to <IP> port 8081 failed: Connection refused
    * Failed to connect to <your host or IP> port 8081: Connection refused
    * Closing connection 0
    curl: (7) Failed to connect to <your host or IP> port 8081: Connection refused

Since the container is exposed to the wider-world, I'd expect the container to also be reachable from other containers.

(Thanks to @cybermcm for reporting this.)

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions