Docker Warpify doesn't work for sub-shell created from a script or an alias command
Discord username (optional)
No response
Describe the bug
After I launch a sub-shell in a running Docker container, with an explicit command in the terminal:
docker exec -it container-name /bin/bash
I get a suggestion to Warpify this sub-shell, making it identical to launching it from Docker Desktop > Extensions > Warp interface, but faster, without the need to choose the Shell command by hand each time.
Yet this Warpify suggestion doesn't work if exactly the same command is called from inside another Shell script or via an alias. The corresponding Ctrl + I shortcut also doesn't do anything in this case.
This bug forces one to either type the whole command each time or use the Docker GUI, which is suboptimal when opening multiple shells under the same container.
To reproduce
This works as expected, allowing to Warpify the sub-shell:
docker exec -it <container ID> /bin/bash
In the following cases Warp doesn't detect the sub-shell as Warpifiable:
alias dshell="docker exec -it <container ID> /bin/bash"
dshell
Same when command is put in a script:
echo "docker exec -it <container ID> /bin/bash" > run.sh
source run.sh
Expected behavior
I would expect Warp to allow worpifying a sub-shell regardless of the exact command used in the console.
Screenshots
This works:
This doesn't work:
Operating system
MacOS
Operating system and version
Sonoma 14.2.1
Shell Version
bash 3.2.57(1)-release (arm64-apple-darwin23)
Current Warp version
v0.2024.01.09.08.02.stable_02
Regression
No, this bug or issue has existed throughout my experience using Warp
Recent working Warp date
No response
Additional context
No response
Does this block you from using Warp daily?
No
Is this a Warp specific issue? (i.e. does it happen in Terminal, iTerm, Kitty, etc.)
Yes, this I confirmed this only happens in Warp, not other terminals.
Warp Internal (ignore): linear-label:b9d78064-c89e-4973-b153-5178a31ee54e
None
hey @bartosik-hep the subshell feature is set up to recognize many commands by default ( like docker), but since you're using the alias and scripts to run the commands, you'll have to add them to your Settings > Subshells > "Added commands" menu for them to be recognized for "Warpification". See more in our docs https://docs.warp.dev/features/subshells and my demo of this below:
https://github.com/warpdotdev/Warp/assets/16809145/923a4ee0-e54b-4006-8d5a-9c27fdfdc91c
This way you can work in the docker container while using an alias. Another option would be to use docker desktop + the Warp extension which we've made to help launch sessions into containers much easier.
Please let me know if the above was helpful, or if you're still seeing issues with enabling subshell sessions.
Thank you for the very comprehensive answer, @dannyneira! It does the trick.
In fact for my specific case, where I have control over the .bashrc of the Docker container I'm running, adding the corresponding automatic command to it, as mentioned in the Warp documentation is the most elegant solution.
If I can suggest one improvement to the Warp extension for Docker Desktop: it's rare that one uses different shells (and users) for the same container, so it would be great if the last choice for the User and Shell were remembered by the extensions, saving 2-4 clicks every time a new shell is opened.
There is one more issue, with TAB autocompletion for paths starting with / in a warpified sub-shell, like shown in the screenshot. Is this known?
Hey @bartosik-hep Thanks for the feedback. I'll closed this as resolved since the issue with the alias/script has a workaround.
Regarding the improvement, docker extension does remember the User/Shell for any existing containers, but doesn't apply those settings by default to new containers. If you can please submit a feature request for that.
Also for the issue with the TAB in a subshell, I'm not seeing what the problem is, you'd see the same running cd / + TAB in a local Mac system as well. It normally shows the subdirectories in the parent folder /.
Example Ubuntu Subshell:
Example Mac local:
@dannyneira the problem is that it doesn't fetch the subfolders for the root / folder in the sub-shell. If you compare what ls / shows and what the TAB completion shows in the screenshot, you can see that in the TAB completion case it shows folders from the current directory (dev/, work/) rather than from the / directory (afs/, bin/, ...).
oh I see, I wonder if the user you're logged into on that subshell has full permissions over the folders in /. That may be part of why the completions aren't loading entirely compared to the result of ls. If you can please open a new bug for that as it appears to be a separate issue from the original one (aliases). https://github.com/warpdotdev/Warp/issues/new/choose
I ran into the same issue: when using "Warpify subshell" command after entering docker container e.g. using docker exec -it <container_name> bash, sometimes tab completion shows paths from the host system and not from inside the container.
The video example here shows that this feature can work correctly, and running both docker run -it ubuntu:latest /bin/bash or docker exec on the same (already running) container does work.
I found that in my case the issue is caused by usage of --net=host flag, and removing it leads to tab completion working correctly inside the container.
Not bumping this thread for a fix, but hope this helps someone.