How to enter in a Docker container already running with a new TTY

前端 未结 11 1366
你的背包
你的背包 2020-11-29 14:20

I have a container that is running the Apache service in the foreground. I would like to be able to access the container from another shell in order to \"poke around\" insid

11条回答
  •  佛祖请我去吃肉
    2020-11-29 14:58

    On Windows 10, I have docker installed. I am running Jnekins on a container and I encountered the same error message. Here is a step by step guide to resolve this issue:

    Step 1: Open gitbash and run docker run -p 8080:8080 -p 50000:50000 jenkins.

    Step 2: Open a new terminal.

    Step 3: Do "docker ps" to get list of the running container. Copy the container id.

    Step 4: Now if you do "docker exec -it {container id} sh" or "docker exec -it {container id} bash" you will get an error message similar to " the input device is not a TTY. If you are using mintty, try prefixing the command with 'winpty'"

    Step 5: Run command " $winpty docker exec -it {container id} sh"

    vola !! You are now inside the terminal.

提交回复
热议问题