Erisa / cloudflared-docker

Simple Alpine-built scratch-runtime Dockerfile for cloudflared, with support for multiple architectures.
https://hub.docker.com/r/erisamoe/cloudflared
Other
158 stars 22 forks source link

Update README.md #13

Closed 1oh1 closed 1 year ago

1oh1 commented 1 year ago

Fix volume mount path

Erisa commented 1 year ago

Hi,

I'm a bit confused by this change.

When I run the original command before the change, it still works:

erisa@Tuturu:~$ docker run -v $PWD/cloudflared:/.cloudflared erisamoe/cloudflared login
Unable to find image 'erisamoe/cloudflared:latest' locally
latest: Pulling from erisamoe/cloudflared
16b3c3280490: Pull complete
58e74c24e7fd: Pull complete
Digest: sha256:a26a02cf334afd7f2cd337a55379b0c7d8f8d369603aacd7a919b55ff401d9d1
Status: Downloaded newer image for erisamoe/cloudflared:latest
Please open the following URL and log in with your Cloudflare account:

https://dash.cloudflare.com/argotunnel?callback=https%3A%2F%2Flogin.cloudflareaccess.org%REDACTED%3D

Leave cloudflared running to download the cert automatically.
You have successfully logged in.
If you wish to copy your credentials to a server, they have been saved to:
/.cloudflared/cert.pem
erisa@Tuturu:~$ ls cloudflared/cert.pem
cloudflared/cert.pem

And as it states in the output, it has saved the file to /.cloudflared/cert.pem, so we bind to that when creating the certificate to store locally.

Are you seeing something different?

1oh1 commented 1 year ago

Sorry about the brain fart. I actually meant to edit a different line in README.md. The error seems to be with this line:

docker run -v $PWD/cloudflared:/.cloudflared erisamoe/cloudflared tunnel create mytunnel

It should be:

docker run -v $PWD/cloudflared:/etc/cloudflared erisamoe/cloudflared tunnel create mytunnel

Output:

1oh1@raspberrypi:~ $ mkdir cloudflared-test
1oh1@raspberrypi:~ $ cd cloudflared-test/
1oh1@raspberrypi:~/cloudflared-test $ mkdir $PWD/cloudflared
1oh1@raspberrypi:~/cloudflared-test $ docker run -v $PWD/cloudflared:/.cloudflared erisamoe/cloudflared login
Please open the following URL and log in with your Cloudflare account:

https://dash.cloudflare.com/argotunnel?callback=https%3A%2F%2Flogin.cloudflareaccess.org%2Fpsdfyg1MvDFRKrguRoxWX299_B1QJFbhKpSAG01MajWPGi4%3D

Leave cloudflared running to download the cert automatically.
You have successfully logged in.
If you wish to copy your credentials to a server, they have been saved to:
/.cloudflared/cert.pem
1oh1@raspberrypi:~/cloudflared-test $ ls cloudflared/
cert.pem
1oh1@raspberrypi:~/cloudflared-test $ docker run -v $PWD/cloudflared:/.cloudflared erisamoe/cloudflared tunnel create mytunnel
2022-12-15T05:20:29Z ERR Cannot find a valid certificate for your origin at the path:

    /etc/cloudflared/cert.pem

If the path above is wrong, specify the path with the -origincert option.
If you don't have a certificate signed by Cloudflare, run the command:

        /cloudflared login
 originCertPath=/etc/cloudflared/cert.pem
failed to create tunnel: couldn't create client to talk to Cloudflare Tunnel backend: Error locating origin cert: cannot find a valid certificate at the path /etc/cloudflared/cert.pem
1oh1@raspberrypi:~/cloudflared-test $ docker run -v $PWD/cloudflared:/etc/cloudflared erisamoe/cloudflared tunnel create mytunnel
Tunnel credentials written to /etc/cloudflared/d8654d527-59c1-4f66-b647-5489466d99540.json. cloudflared chose this file based on where your origin certificate was found. Keep this file secret. To revoke these credentials, delete the tunnel.

Created tunnel mytunnel with id d8654d527-59c1-4f66-b647-5489466d99540

I was following instructions from the README on your Dockerhub page, which seems to be slightly outdated as the problematic line has already been fixed by https://github.com/Erisa/cloudflared-docker/pull/11

Erisa commented 1 year ago

Hey @1oh1 no worries about the confusion.

I've updated the Dockerhub README with the latest changes on the repo - does this resolve the confusion or are there any other changes that need to be made?

1oh1 commented 1 year ago

Thanks @Erisa, that resolves it. No other changes are required. I'll close the issue.