Error “The input device is not a TTY”

后端 未结 11 1243
野的像风
野的像风 2020-11-27 09:20

I am running the following command from my Jenkinsfile. However, I get the error \"The input device is not a TTY\".

docker run -v $PWD:         


        
11条回答
  •  悲哀的现实
    2020-11-27 09:43

    I know this is not directly answering the question at hand but for anyone that comes upon this question who is using WSL running Docker for windows and cmder or conemu.

    The trick is not to use Docker which is installed on windows at /mnt/c/Program Files/Docker/Docker/resources/bin/docker.exe but rather to install the ubuntu/linux Docker. It's worth pointing out that you can't run Docker itself from within WSL but you can connect to Docker for windows from the linux Docker client.

    Install Docker on Linux

    sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
    sudo apt-get update
    sudo apt-get install docker-ce
    

    Connect to Docker for windows on the port 2375 which needs to be enabled from the settings in docker for windows.

    docker -H localhost:2375 run -it -v /mnt/c/code:/var/app -w "/var/app" centos:7

    Or set the docker_host variable which will allow you to omit the -H switch

    export DOCKER_HOST=tcp://localhost:2375

    You should now be able to connect interactively with a tty terminal session.

提交回复
热议问题