-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TTY Error running interactive docker on Bash on Windows #1588
Comments
Um, No different running without the .exe, not sure why you expected that would work jtrutwin@DESKTOP-PAK1BAG MINGW64 ~/git-projects/Hive (master) Also running into this issue, hoping there's a fix down the road. Thanks. |
Anybody find the solution to this issue? I am facing this one too. |
Any update on this issue? |
I had the same problem. Below are my findings: The command Perhaps one should not use Still I haven't figured out why Tzu-Ray |
Issues go stale after 90d of inactivity. Prevent issues from auto-closing with an If this issue is safe to close now please do so. Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. |
Any news on this? |
/remove-lifecycle stale I'm also wondering about this. Would be nice if this worked seamlessly in WSL! |
On git bash just type: after starting the docker I mean when it will run then create docker conatainer |
I was also seeing this problem, but after updating from version 1803 to 1809 it seems to have gone away (https://en.wikipedia.org/wiki/Windows_10_version_history). |
If your application does not need to send output text/etc to another application (e.g. for piping), then you don't need to run using the # this should still output to your console
docker run hello-world In response to #1588 (comment) docker run -p 80:80 nginx |
I tried like so. Worked 😹 |
April 2019 - still seems to be a problem on Windows 10. |
same error here - I have to run it though winpty |
Just run into this error using zsh in Unbuntu in Hyper:
When I run the command in cmd.exe it works. |
Just ommitting $ docker run --rm -it debian:latest /bin/bash
the input device is not a TTY. If you are using mintty, try prefixing the command with 'winpty' Using $ winpty docker run --rm -it debian:latest /bin/bash
C:/Program Files/Docker/Docker/Resources/bin/docker.exe: Error response from daemon: OCI runtime create failed: container_linux.go:344: starting container process caused "exec: \"C:/Users/foo/AppData/Local/Programs/Git/usr/bin/bash.exe\": stat C:/Users/foo/AppData/Local/
Programs/Git/usr/bin/bash.exe: no such file or directory": unknown. |
Still does not work for me. here is what i need to run from git bash on windows tried to drop the -i bc it is griping about input so i changed to this tried to drop all stdin stdout related work
|
I didn't put the full path in for bash and it worked for me |
bump |
Bump |
Okay, but this appears to me more like a workaround than a solution. Based on your hint, I found the following commands also working (which for the moment confuses me): I don't know. Using |
winpty docker -it run simcompdocker /bin/bash this is incorrect so the -it goes after the run so Either way if even easy commands are failing like hello-world. Almost looks like something is not installed right. $ winpty docker run hello-world $ docker run hello-world didnt even need winpty to run hello-world I also am using git-bash and windows docker full install, windows 10. But i am not expert here. |
This is the alias I'm using, which seem to do the trick: |
#!/bin/bash this two step approach to get the output is what I use as a workaround when scripting to container |
Is there any fix ? issue:Docker version: 19.03.1 (windows) Invoking container from CMD: (works fine) C:\Users\muthu>docker exec -it c31d1f693b74 /bin/bash Same thing from git bash# (Not working) $ docker exec -it c31d1f693b74 /bin/bash 60135734@EHL5CG72513QQ MINGW64 ~ (master) Work around: As suggested by @siochs work's fine. $ winpty docker exec -it c31d1f693b74 //bin//bash |
as written by @siochs before:
the best workaround I could find is using a better winpty. $ where winpty
C:\Users\valerio\bin\winpty.exe
C:\Program Files\Git\usr\bin\winpty.exe at this point the escaping will be correct ✔️ $ winpty echo "/data"
/data instead of the dreaded 🤬 $ winpty echo "/data"
C:/Program Files/Git/data For a longer explanation, refer to this issue on MSYS2-packages, and specifically this comment This is such a LONG standing issue, by now I could apply for a paleontologist job. |
This work for me on windows: winpty docker run -it ubuntu bash. |
worked for me |
@jjqq2013 the output says you to put the prefix winpty: winpty docker exec -it ubuntu: bash |
@joseaburt thank you for your kind reply. I just find that directly running "C:\Program Files\Git\bin\bash.exe" will have no such problem. |
I had this issue and fixed it by updating mintty through the Cygwin installer: mintty 3.1.4 (x86_64-pc-cygwin) |
This worked for me: Then ssh into a container like so: I was using docker exec nginx-test /bin/bash and this doesnt work. Just remove the /bin/ and just use bash. Summary: In git bash on windows 10. Run these commands: Thanks everyone for helping! |
@inspiretk That is because of MinGW's (which Git Bash uses) Posix path conversion. While only using $ docker exec -it containerName //bin/bash (notice the double $ MSYS_NO_PATHCONV=1 docker exec -it containerName /bin/bash |
i switched to new newest version of msys2 and started using mingw based on that (instead of the one that comes with git) and I am having much better success. Just an fyi for everyone interested in different method |
This occurs on WSL as well...
gave me samer error when running aws cli. I don't want to use git-bash :( |
winpty docker run -it ubuntu bash |
this comand worked for me,try using winpty |
Found a work-around (based on above winpty suggestion). Scenario:Run a bash script containing TTY (input/output) commands using mingw64/git bash. Successful Command
Result:
Unsuccessful Command (script as command)
Result: winpty: error: cannot start 'C:/data/gitrepo2/reaction-development-platform/reaction/bin/package-link api-plugin-inventory-simple': %1 is not a valid Win32 application. (error 0xc1) Unsuccessful Command (no winpty, directly invoke bash script)
Result: \nUsing local package path /c/data/gitrepo2/reaction-development-platform/api-plugins/api-plugin-inventory-simple
If this is not correct, specify the correct path as the second argument.\n
Making directory /home/node/copied-packages/api-plugin-inventory-simple in 'api' container
the input device is not a TTY. If you are using mintty, try prefixing the command with 'winpty' Root cause of TTY error: Referenced Bash Script#!/usr/bin/env bash
# Please Use Google Shell Style: https://google.github.io/styleguide/shell.xml
# ---- Start unofficial bash strict mode boilerplate
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -o errexit # always exit on error
set -o errtrace # trap errors in functions as well
set -o pipefail # don't ignore exit codes when piping output
set -o posix # more strict failures in subshells
# set -x # enable debugging
IFS="$(printf "\n\t")"
# ---- End unofficial bash strict mode boilerplate
package_name=$1
package_path=$2
container_id="$(docker-compose ps -q api)"
container_copied_packages_path="/home/node/copied-packages"
container_destination_path="${container_copied_packages_path}/${package_name}"
if [[ -z "${package_path}" ]]; then
package_name_without_org="${package_name/#@reactioncommerce\/}"
package_path="../api-plugins/${package_name_without_org}"
full_package_path="$(cd ${package_path} && pwd)"
echo "\nUsing local package path ${full_package_path}"
echo "If this is not correct, specify the correct path as the second argument.\n"
fi
echo "Making directory ${container_destination_path} in 'api' container"
docker-compose exec api sh -c "mkdir -p ${container_destination_path}"
echo "Copying local ${package_name} package code into container path ${container_destination_path} ..."
docker cp "${package_path}/." "${container_id}:${container_destination_path}"
# Then npm link into this project
echo "Linking package into API..."
docker-compose exec api sh -c "npm config set prefix /home/node/npm && cd /usr/local/src/app && npm link "${container_destination_path}""
# Fool nodemon into thinking something has changed so that it restarts.
# Touch first file found in /src with .js extension
echo "Restarting API..."
docker-compose exec api sh -c "touch -c $(ls ./src/*.js | head -n1)" |
I wish there was a way to highlight the simplest answer... @joseaburt you nailed it! Simple Solutionrun <git for windows root>\bin\bash.exe Successful Command
ResultUsing local package path /c/data/gitrepo2/reaction-development-platform/api-plugins/api-plugin-inventory-simple
If this is not correct, specify the correct path as the second argument.\n
Making directory /home/node/copied-packages/api-plugin-inventory-simple in 'api' container
Copying local api-plugin-inventory-simple package code into container path /home/node/copied-packages/api-plugin-inventory-simple ... The process tree |
Combining a few answers as the docker tutorial commands:
Fail with the linux to windows name mangling and the tty emulation in git for windows bash. .bashrc
|
thanks
…On Thu, Sep 24, 2020 at 8:26 AM Barrie Treloar ***@***.***> wrote:
Combining a few answers as the docker tutorial commands:
docker exec e60043f6fcd3 cat /data.txt
docker run -it ubuntu ls /
Fail with the linux to windows name mangling and the tty emulation in git
for windows bash.
# docker-archive/toolbox#673 (comment)
# Workaround for Docker for Windows in Git Bash.
docker()
{
(export MSYS_NO_PATHCONV=1; winpty "docker.exe" "$@")
}
# Workaround for tty issues and docker
# See:
# * msys2/MSYS2-packages#411 (comment)
# * #1588 TTY Error running interactive docker on Bash on Windows
# * rprichard/winpty#125 winpty not respecting non-path-munging env vars, or aliases
# Install newer version of WINPTY as per #1588 (comment)
export WINPTY_HOME=/C/winpty-0.4.3-msys2-2.7.0-x64
export PATH=${WINPTY_HOME}/bin:$PATH
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1588 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AN24JV3OETQBYX57XGKAZ6DSHKYMJANCNFSM4EMVGMDA>
.
|
Issues go stale after 90 days of inactivity. Prevent issues from auto-closing with an If this issue is safe to close now please do so. Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. |
This is still an issue, is the fix on the roadmap? |
I have experienced this error, similar to @ray1007 |
Closed issues are locked after 30 days of inactivity. If you have found a problem that seems similar to this, please open a new issue. Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. |
A quick search online showed that a lot of people are frustrated about this issue. Basically, I'm trying to run Docker for Windows from the Bash on WSL (Windows Subsystem for Linux) on Windows 10 Creator Edition.
Returns this error:
The suggested solutions typically require installing external tools to work around the issue. I prefer not to prefix all my docker commands with
winpty
because then my scripts won't run on Linux boxes. And, actually, I prefer not to have to installwinpty
or any other tool just to work-around this issue. Can someone at Docker fix the issue at the root please?Based on this thread, it seems this is a Docker issue. Quoting:
Please look into it. You'd save your community a lot of frustration.
The text was updated successfully, but these errors were encountered: