open-telemetry / opentelemetry.io

The OpenTelemetry website and documentation
https://opentelemetry.io
Creative Commons Attribution 4.0 International
535 stars 1.17k forks source link

Quick Start docker run fails on Windows with `An attempt was made to access a socket in a way forbidden by its access permissions` #5231

Open johnmccabe opened 4 weeks ago

johnmccabe commented 4 weeks ago

What needs to be changed? Docker run command in step 3 fails on Windows (in both WSL and natively) with the following error.

docker: Error response from daemon: Ports are not available: exposing port TCP 0.0.0.0:55679 -> 0.0.0.0:0: listen tcp 0.0.0.0:55679: bind: An attempt was made to access a socket in a way forbidden by its access permissions.

The otel/opentelemetry-collector-contrib image binds zpages to port 55679 by default and this can clash with reserved ports on Windows (may be HyperV related).

# netsh interface ipv4 show excludedportrange protocol=tcp

Protocol tcp Port Exclusion Ranges

Start Port    End Port
----------    --------
     ... snip...
     55616       55715
     ... snip...

* - Administered port exclusions.

Passing in an updated config.yaml with zpages on an unreserved port, for example 9999 below, and altering the port mapping in the docker run works.

...snip...
extensions:
  health_check:
  pprof:
    endpoint: 0.0.0.0:1777
  zpages:
    endpoint: 0.0.0.0:9999
...snip...
docker run -p 127.0.0.1:4317:4317 -p 127.0.0.1:9999:9999 -v ${PWD}/config.yaml:/etc/otelcol-contrib/config.yaml otel/opentelemetry-collector-contrib:0.109.0  2>&1 | tee collector-output.txt

Primarily raising this for visibility should anyone else encounter the problem.

What is the name + path of the page that needs changed? https://opentelemetry.io/docs/collector/quick-start/

tiffany76 commented 3 weeks ago

Thanks for reporting this issue, @johnmccabe.

@open-telemetry/collector-approvers, should we add a note to the documentation about the default port for zpages?

mx-psi commented 2 weeks ago

We can add a note about reserved ports on this docs page if that helps people troubleshoot. @johnmccabe would you be up to filing a small PR for this?