(Was asked here, was closed because "not about programming or software development.")
Situation: I have a Docker Compose setup with multiple containers from different images. I have Docker Desktop to access the terminals via the "Exec" tab. I run terminal scripts in some containers.
Problem: Some terminals don't allow arrow navigation. When I press Key-Up, I receive ^[[A.
Temporary solution: According to https://stackoverflow.com/questions/69179458/how-to-permanently-enable-arrow-keys-for-docker-desktop-cli I can run /bin/bash before doing anything else. But this works only as long as the container lives.
Question: How to configure a container in the Docker Compose file, so that Docker Desktop's "Exec" Tab runs by default with /bin/bash?
- I tried multiple things with
commandandpost_start, but nothing worked. Either the container failed to start, or the Terminal was not in bash mode. - I don't want to build a custom image just for this behavior.
- I use Windows and WSL 2.
To reproduce:
services: arrow-working: image: php:8.1.11-fpm-alpine arrow-not-working: image: postgres:15.2 # what to add here, to automatically enable bash in Docker Desktop Exec? environment: POSTGRES_PASSWORD: foo 
/bin/shand/bin/bash. You can also installrlwrapand runrlwrap sh, which providesreadlineand arrow key support. Either way, this requires building a new image. Now, what you are asking for has been requested multiple times, so it may be added in the near future. In the meantime, you can always open an issue or submit your own PR to the project.