jesseduffield / jesseduffield/lazydocker
Custom command passing a string literal
- Dominant language
- Go
- Stars
- 52.8k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
**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:
1. Create a custom command in `config.yml`
```yaml
- 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
```
or
```yaml
- 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'
```
2. Open lazydocker
3. Run the command
4. Raises error:
```bash
+ 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](https://docs.docker.com/storage/bind-mounts/) got the same results.
Contributor guide
Assessment
This issue has not been assessed yet.