My OS is Windows. When creating a Docker container and interacting with it using Windows powershell:
docker create -i --name test_container debian
docker container start -i test_container
And running a command such as ls
, then it gives the following error:
bash: line 2: $'lsr': command not found
I assume this is because newlines in windows (rn
) are different than unix (n
).
How can I use powershell interactively with Docker?
I’ve searched online for a solution on this, but only get results on converting files, not working with powershell directly. I’ve also looked through the settings of Docker to see if there’s an option on this, but am unable to find anything to change this behavior. Running docker start --help
does not provide any special options for usage with powershell.
I specifically want to use powershell as I dislike cmd and the shell provided by Docker (the up/down keys don’t work as expected for example).
2
Answers
I only now realized that I should pass the pseudo-tty option (
-t
) when creating the container.The following runs without issue:
The problem is thus solved.
Run it as:
Here the explaination of the flags: