Trying to get zrok to work with Docker Share

I am following the Docker public share instructions. When I attempt to connect to the share address the following error occurs in docker logs:

zrok-share-1  | INFO: reading share configuration from environment variables
zrok-share-1  | INFO: zrok backend is already reserved: gttesting
zrok-share-1  | INFO: running: zrok share reserved gttesting --headless true --override-endpoint http://localhost:19999
zrok-share-1  | [   0.384]    INFO main.(*shareReservedCommand).run: sharing target: 'http://localhost:19999'
zrok-share-1  | [   0.384]    INFO main.(*shareReservedCommand).run: using existing backend target: http://localhost:19999
zrok-share-1  | [   1.425]    INFO sdk-golang/ziti.(*listenerManager).createSessionWithBackoff: {session token=[b21d9983-a527-4fce-b40a-1c36b75a6f4f]} new service session
zrok-share-1  | [   1.606]    INFO main.(*shareReservedCommand).run: access your zrok share: https://gttesting.share.zrok.io
zrok-share-1  | [  15.710]    INFO main.(*shareReservedCommand).run: [] -> GET /
zrok-share-1  | [  15.710]   ERROR zrok/endpoints/proxy.newReverseProxy.func2: error proxying: dial tcp [::1]:19999: connect: connection refused

I am not sure how to debug or what I might be doing wrong. I can access http://localhost:19999 from the host so that service is running.

Hi @chiappone, welcome to the community and to zrok (and OpenZiti)!

ERROR zrok/endpoints/proxy.newReverseProxy.func2: error proxying: dial tcp [::1]:19999: connect: connection refused

When you run inside a docker container "localhost" is not the same "localhost". Are you trying to access another container? If so - use the hostname of that container not 'localhost'., it's the localhost of the container itself: the zrok share container.

Are you trying to access something "outside" docker?

Maybe that will give you enough of a hint, the routing to "localhost" is local only to that docker container. I wouldn't expect your zrok share container to have a port 19999.

That make sense?

Thanks so much using

    extra_hosts:
      - "host.docker.internal:host-gateway"

Solved my issue and i could use that as the host.

1 Like