I have also tried using FLY_API_TOKEN instead of FLY_ACCESS_TOKEN. I also tried adding a -t <my token>. None of them worked and all returned the same error:
Error No access token available. Please login with 'flyctl auth login'
However, I am logged in. I have done that process multiple times now and have a generated token.
Hi @cinjon could you help me out a bit with what’s happening here? You’re on macOS, you’ve logged in on your macOS terminal, and you want to pass that auth token into the flyio/flyctl container in order to use the flyctl inside there to deploy an app? And the fly/fly.api.toml and docker/Dockerfile.api have already been copied into the container at this point?
I’ve gotten some help from the team, and we realised that KEY=value echo $KEY doesn’t actually work because $KEY is evaluated before the value is set.
So the way to get this to work might be to run docker run -it --rm -v "$(pwd):$(pwd)" --env "FLY_ACCESS_TOKEN=<my_token>" flyio/flyctl:v0.0.250 -c fly/fly.api.toml deploy --dockerfile docker/Dockerfile.api with the key in there directly.
There is no problem installing flyctl on macOS. That seems to have worked np - I can auth in, etc, no problem.
You’re on macOS, you’ve logged in on your macOS terminal, and you want to pass that auth token into the flyio/flyctl container in order to use the flyctl inside there to deploy an app? Yes!
And the fly/fly.api.toml and docker/Dockerfile.api have already been copied into the container at this point? Hmm, no, I haven’t done that. Where does it say that in the steps? Apologies if I missed it. I was counting on the docker run... to build everything appropriately.
I might be missing something on point 3, not familiar enough with Docker to know if setting -v "$(pwd):$(pwd) gives access to the current directory.
On the question of the auth token not being passed in, though, you can try
export FLY_ACCESS_TOKEN=<my_token>
docker run -it --rm -v "$(pwd):$(pwd)" --env "FLY_ACCESS_TOKEN=$FLY_ACCESS_TOKEN" flyio/flyctl:v0.0.250 apps list
or
docker run -it --rm -v "$(pwd):$(pwd)" --env "FLY_ACCESS_TOKEN=<my_token>" flyio/flyctl:v0.0.250 apps list
to make sure flyctl has the token correctly.
If you have flyctl installed on macOS already, you might not even need the flyctl container, you could just do flyctl deploy -c fly/fly.api.toml --dockerfile docker/Dockerfile.api
Which guide are you following at this point? Doing the operation inside the container seems necessary if you have the CLI installed and have the .toml and Dockerfile.api right there.