Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Docker alias command #36

Merged
merged 1 commit into from
Nov 13, 2023
Merged

Updated Docker alias command #36

merged 1 commit into from
Nov 13, 2023

Conversation

zupolgec
Copy link
Contributor

Given .bashrc / .zshrc files are normally stored in the home fodler (~) folder, the $PWD variable becomes ~ even if the alias is called from another folder. Wrapping the alias command in single quotes avoids this premature expansion of the variable.

@@ -14,7 +14,7 @@ gem install kamal
...otherwise, you can run a dockerized version via an alias (add this to your .bashrc or similar to simplify re-use). On macOS, use:

```sh
alias kamal="docker run -it --rm -v '${PWD}:/workdir' -v '/run/host-services/ssh-auth.sock:/run/host-services/ssh-auth.sock' -e SSH_AUTH_SOCK='/run/host-services/ssh-auth.sock' -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/basecamp/kamal:latest"
alias kamal='docker run -it --rm -v "${PWD}:/workdir" -v "/run/host-services/ssh-auth.sock:/run/host-services/ssh-auth.sock" -e SSH_AUTH_SOCK="/run/host-services/ssh-auth.sock" -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/basecamp/kamal:latest'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zupolgec thank you for the fix!

I've identified another issue with this alias that is not directly related to the problem you are addressing. However, resolving it may involve introducing another expansion here. The location of the socket can vary across systems. In case of Linux, it is discoverable through the $SSH_AUTH_SOCK variable and is located at /run/user/1000/keyring/ssh, not /run/host-services/ssh-auth.sock like in macOS.

The $SSH_AUTH_SOCK variable should also be available in macOS. Having it used here might unify the alias for both macOS and Linux.

Suggested change
alias kamal='docker run -it --rm -v "${PWD}:/workdir" -v "/run/host-services/ssh-auth.sock:/run/host-services/ssh-auth.sock" -e SSH_AUTH_SOCK="/run/host-services/ssh-auth.sock" -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/basecamp/kamal:latest'
alias kamal='docker run -it --rm -v "${PWD}:/workdir" -v "${SSH_AUTH_SOCK}:/run/host-services/ssh-auth.sock" -e SSH_AUTH_SOCK="/run/host-services/ssh-auth.sock" -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/basecamp/kamal:latest'

Not sure if I should open a separate PR to propose the change. WDYT?

@dhh dhh merged commit 6e2c8ca into basecamp:main Nov 13, 2023
@zupolgec zupolgec deleted the patch-1 branch November 13, 2023 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants