Totti
August 3, 2024, 5:49am
1
Hi, I don’t want to install go and flyctl in my environment and use the dockerized version of flyctl. I have no problems running commands, even auth login is no problem. But how to I persist my credentials, which volume do I have to bind mount?
Idea would be to have an alias command named flyctl defined as ‘docker run -it Package flyctl · GitHub ’, which would enable me to use flyctl as if it was installed locally.
thanks a lot in advance
That would be `~/.fly. From the install script:
flyctl_install="${FLYCTL_INSTALL:-$HOME/.fly}"
You can customize the location of the FLYCTL_INSTALL
Take note, if you’re mounting this directory, you basically have an install, just that the binary is not available in your PATH
If you want to be sure to not even have the binary and just the state/config files:
docker run \
--mount type=bind,src=/<host-folder>,dst=~/.fly \
--mount type=volume,dst=~/.fly/bin/
Totti
August 4, 2024, 11:56am
3
Hey thanks a lot for your reply! Though I’m having two issues with it:
you are not refering to the official docker image, do you? As the official one is based on scratch (flyctl/Dockerfile at master · superfly/flyctl · GitHub ) it doesn’t seem to know something like a home directory.
Docker tells me that I am not allowed to mountbind relative paths (~)
Nevertheless I appreciate your approach and am still optimistic to find a solution
Any idea on how to fix those issues?
Ahh, I have an idea
Try setting an env var for FLY_CONFIG_DIR
So you could do something like:
docker run \
--mount type=bind,src=/<host-folder>,dst=/.config \
--mount type=volume,dst=/.config/bin/ \
-e FLY_CONFIG_DIR="/.config"
In theory, this should then persist the socket.
Totti
August 5, 2024, 7:30pm
5
Haha, amazing! Thanks a lot - it works
So I ended up with this alias entry in my .bash_aliases:
alias flyctl='docker run -it --rm --name flyctl --mount type=bind,src=/<HOST CONFIG FOLDER>,dst=/.config --mount type=volume,dst=/.config/bin/ -e FLY_CONFIG_DIR="/.config" ghcr.io/superfly/flyctl:latest'
works like a charm!
1 Like
system
Closed
August 12, 2024, 7:31pm
6
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.