lazydocker
lazydocker copied to clipboard
Custom command passing a string literal
Describe the bug
Running an ad hoc docker run command in the terminal works. Passing the same command to lazydocker as either a scalar (folded/literal) or inline fails.
To Reproduce Steps to reproduce the behavior:
- Create a custom command in
config.yml
or- name: run-meetup attach: true command: > docker run -it --name meetup_bot -p 80:3000 -e PORT="3000" -v "$(pwd)":/home/appuser/app --env-file .env meetup_bot bash- name: run-meetup attach: true command: 'docker run -it --name meetup_bot -p 80:3000 -e PORT="3000" -v "$(pwd)":/home/appuser/app --env-file .env meetup_bot bash' - Open lazydocker
- Run the command
- Raises error:
+ docker run -it --name meetup_bot -p 80:3000 -e PORT=3000 -v $(pwd):/home/appuser/app --env-file .env meetup_bot bash docker: Error response from daemon: create $(pwd): "$(pwd)" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path. See 'docker run --help'.
Expected behaviour
It should interpolate/expand the pwd command or $PWD built-in variable in the command. Only able to hard-code the absolute path to work around the issue. Less than ideal, of course.
Screenshots N/A
Desktop (please complete the following information):
- OS: macOS 12.4 (21F79)
- Lazydocker Version: v0.18.1
- The last commit id if you built project from sources: N/A
Additional context Using the new docker mount syntax got the same results.
$(pwd) have to run in the shell, but lazydocker seems like run command directly.
I think this is not bug, but run commands through shell will be more convenient I think.
What would you suggest the workflow should be if this isn't a bug @skanehira?
I agree, we ought to run all custom commands in a shell so that things like $(pwd) can be evaluated. We do that currently with lazygit
The place we could update is here. In lazygit we have a NewShell function which takes a command and wraps it in a shell invocation (see here) so we can copy that approach in lazydocker
I'll tackle this one.
go ahead @gusandrioli :)
Appreciate the follow-up! 🙏
@pythoninthegrass PR was merged :)