# Docker example for private share does not work

**URL:** <https://openziti.discourse.group/t/docker-example-for-private-share-does-not-work/3533>\
**Category:** General Questions\
**Created:** [December 4, 2024, 4:17am UTC](https://openziti.discourse.group/t/docker-example-for-private-share-does-not-work/3533 "2024-12-04T04:17:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![workmaster2n](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/workmaster2n/32/2826_2.png) [@workmaster2n](https://openziti.discourse.group/u/workmaster2n)\
**Post date:** [December 4, 2024, 4:17am UTC](https://openziti.discourse.group/t/docker-example-for-private-share-does-not-work/3533/1 "2024-12-04T04:17:21Z")

</div>

Trying to follow the example here: [Docker Private Share | Zrok](https://docs.zrok.io/docs/guides/docker-share/docker_private_share_guide/)

Looking at the contents of the file in the linked video, it appears that [https://docs.zrok.io/zrok-private-share/compose.yml](https://docs.zrok.io/zrok-private-share/compose.yml) has changed and no longer works out of the box.

It looks like other people have noticed the issue ([Issues using zrok with docker compose](https://openziti.discourse.group/t/issues-using-zrok-with-docker-compose/3441)), and the problem is that there is no `ZROK_TARGET` defined.

Looking at the docker compose file, I see that `ZROK_TARGET` is a blanked out env variable.

Disclaimer: I have only briefly tried trouble shooting this. I came across ZROK while talking to a friend, so just wanted to have the most basic hello world example so I could poke around with ZROK. If there is a demo somewhere that works without needing additional configuration, that will work for me.

---

<div class="post-metadata">

**Author:** ![qrkourier](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/qrkourier/32/52_2.png) [@qrkourier](https://openziti.discourse.group/u/qrkourier)\
**Post date:** [December 4, 2024, 5:20am UTC](https://openziti.discourse.group/t/docker-example-for-private-share-does-not-work/3533/2 "2024-12-04T05:20:09Z")

</div>

Welcome, @workmaster2n!

I did stumble upon a Docker private share issue the other day. It's probably the same one you encountered because it broke all Docker private shares because the share script erroneously tried to print the public frontend endpoint, which doesn't exist for a private share 🤦‍♂️.

[The fix](https://github.com/openziti/zrok/pull/801/files#diff-091ae4eb444dd6af6f0e69000576d9506c4a3f877644940a3d65add02d570630) was just accepted and will be in the next release.

You can preview this patch by pulling the Docker image I made in my account.

```bash
ZROK_CONTAINER_IMAGE="kbinghamnetfoundry/zrok:0.0.43500@sha256:96206a46243002503899ff9e7b5d827d0352ff75bf3371377eb32d9335a0a768"

```

Personal GitHub fork where I'm testing this: [Release v0.0.43500 · qrkourier/zrok · GitHub](https://github.com/qrkourier/zrok/releases/tag/v0.0.43500)

Here's the Docker private share compose.yml I tested it with.

```yaml
services:
  zrok-init:
    image: busybox
    # matches uid:gid of "ziggy" in zrok container image
    command: chown -Rc 2171:2171 /mnt/.zrok
    user: root
    volumes:
      - zrok_env:/mnt/.zrok

  # enable zrok environment
  zrok-enable:
    image: ${ZROK_CONTAINER_IMAGE:-docker.io/openziti/zrok}
    depends_on:
      zrok-init:
        condition: service_completed_successfully
    entrypoint: zrok-enable.bash
    volumes:
      - zrok_env:/mnt
    environment:
      HOME: /mnt
      ZROK_ENABLE_TOKEN:
      ZROK_API_ENDPOINT:
      ZROK_ENVIRONMENT_NAME: docker-kentest-private

  zrok-share:
    image: ${ZROK_CONTAINER_IMAGE:-docker.io/openziti/zrok}
    restart: unless-stopped
    entrypoint: zrok-share.bash
    depends_on:
      zrok-enable:
        condition: service_completed_successfully
    volumes:
      - zrok_env:/mnt
    environment:
      # internal configuration
      HOME: /mnt # zrok homedir in container

      # most relevant options
      ZROK_UNIQUE_NAME: # name is used to construct frontend domain name, e.g. "myapp" in "myapp.share.zrok.io"
      ZROK_BACKEND_MODE: proxy
      ZROK_TARGET: http://zrok-test:9090
      ZROK_INSECURE: # "--insecure" if proxy target has unverifiable TLS server certificate
      ZROK_BASIC_AUTH: # username:password
      ZROK_PERMISSION_MODE: closed
      ZROK_ACCESS_GRANTS: # space-separated list of additional zrok account emails to grant access in closed permission mode

      # least relevant options
      ZROK_VERBOSE: # "--verbose"
      ZROK_SHARE_OPTS: # additional arguments to "zrok reserve private" command
      ZROK_FRONTEND_MODE: reserved-private
      PFXLOG_NO_JSON: "true" # suppress JSON logging format

  # demo server you can share with zrok
  zrok-test:
    image: ${ZROK_CONTAINER_IMAGE:-docker.io/openziti/zrok}
    command: test endpoint --address 0.0.0.0 # 9090

volumes:
  zrok_env:

```

---

<div class="post-metadata">

**Author:** ![workmaster2n](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/workmaster2n/32/2826_2.png) [@workmaster2n](https://openziti.discourse.group/u/workmaster2n)\
**Post date:** [December 4, 2024, 7:42am UTC](https://openziti.discourse.group/t/docker-example-for-private-share-does-not-work/3533/3 "2024-12-04T07:42:28Z")

</div>

Thanks for that quick reply @qrkourier - I didn't use your image, I just used your docker file and the demo at least starts up this time.

I think the key was

```auto
ZROK_TARGET: http://zrok-test:9090

```

I noticed that there was a `zrok-test` container in the broken compose file, but I wasn't sure how the setup went.

I'll let you know how I go!

---

<div class="post-metadata">

**Author:** ![qrkourier](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/qrkourier/32/52_2.png) [@qrkourier](https://openziti.discourse.group/u/qrkourier)\
**Post date:** [December 4, 2024, 5:24pm UTC](https://openziti.discourse.group/t/docker-example-for-private-share-does-not-work/3533/4 "2024-12-04T17:24:40Z")

</div>

The `ZROK_TARGET` value specifies what you wish to share with zrok. There's no default value. Examples of things you can share are web servers or static files via HTTP, including a website.

I used the compose.yml from [the Docker private share guide](https://docs.zrok.io/docs/guides/docker-share/docker_private_share_guide/) and defined a few environment variables to represent my private share. You may define env vars in the compose file or in an `.env` file in the same directory. As you noted, I set the target to the included testing web server container in the example compose file.
