Zrok environment not mounting to docker container

Hello, I am hoping someone has seen this before but when running a docker compose I am getting this error from the docker container logs unable to load environment; did you 'zrok enable'?

My host is a windows machine that has the zrok environment enabled already since it has executed the command zrok enable <my-token>

I'm not sure why the environment is not being mounted onto the docker container the error message is inconclusive. Here is the guide I am using for setting up the docker container Getting Started with Docker | Zrok

Here is my compose.yaml:

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

Does ${HOME} work on windows? Are you running docker from WSL or from docker desktop? I use WSL myself, not docker desktop but I'm thinking that ${HOME} is the culprit?

I can't test the theory myself, but that'd be my quick guess.

Hi @TheLumberjack thank you for the quick response and for welcoming me to the community!! I'm running docker from docker desktop - after removing ${HOME} I still see the same error but yes i believe ${HOME} is not supported by windows

Oh sorry, I should have said you should replace it with whatever your userprofile is. for example for me, it'd be c:/users/clint/.zrok

I assume you also have a c: but from any prompt you can just run:

echo %userprofile%\.zrok
-- or if powershell --
echo $env:USERPROFILE\.zrok

add that in there instead of $HOME

Hmmm adding that looks like this C:/Users/MyComputer/.zrok/.zrok:/.zrok and it is showing the same error I also tried C:/Users/MyComputer/.zrok:/.zrok just in case but still it also shows that it cannot load the environment

You have a doubled up .zrok there. It should be:

 C:/Users/MyComputer/.zrok/:/.zrok 

I can install docker desktop and try it out if taht doesn't solve it

I tried with the above path and see the same error

Heres a screenshot of my C:/Users/MyComputer/.zrok path contents

Alright. I'll see if I can install docker desktop and give it a try. It might not be tonight, gimme a bit :slight_smile:

Absolutely and no rush I appreciate you even looking into this with me and how responsive you are, thank you!!!

Here's how you'd do it with Windows and Docker Desktop:

services:
  zrok:
    image: openziti/zrok
    restart: unless-stopped
    volumes:
      - ${USERPROFILE}/.zrok:/home/ziggy/.zrok
    environment:
      PFXLOG_NO_JSON: "true"
    #entrypoint: ""
    #command: sleep 1000
    command: share reserved "xi2r7950z3to" --headless

Key points:

  • removed user: "${UID}", windows doesn't have a UID...
  • used ${USERPROFILE} to find the zrok user dir
  • used the home folder of the user inside docker for the mount point: ${USERPROFILE}/.zrok:/home/ziggy/.zrok
  • I ran zrok reserve public https://google.com to get a reserved token: your reserved share token is 'xi2r7950z3to'

Hope that solve your problem. One thing to make sure of is that your docker container can resolve and get to whatever you "reserve/share". It's easy to make a share that doesn't work from inside docker :slight_smile:

Oh, btw, I left:

    #entrypoint: ""
    #command: sleep 1000

in the compose file... You can uncomment those (and comment out the other command) to exec into the container to poke around:

C:\Users\clint>docker exec -it clint-zrok-1 bash
[ziggy@473944b2cda5 ~]$ ls $HOME/.zrok
environment.json  identities  metadata.json
[ziggy@473944b2cda5 ~]$

When inside the container, the ziggy user will need to be able to read all the files in $HOME/.zrok, in case you need to debug anything.

@TheLumberjack Clint thank you so much for helping me out with this and for the extra snippets, comments, and screenshots sincerely appreciate it. I was able to get it working after your help thank you!!!!!!!!!!!!!!!!!!

1 Like