Docker Community Forums

Share and learn in the Docker community.

Docker Attach Not Working Right

Hey Everyone, I was introduced to Docker in a bootcamp and understand it, but am having a strange, but I think simple issue. I installed Docker on my MacBook Pro (2019) and can run docker commands in the Mac Terminal with no issue. I downloaded the Ubuntu:latest container and want to connect to run commands on there. I start the container and then run docker attach Ubuntu (the name for the container) and my command line changes to the Ubuntu container. The problem is I can’t successfully run any commands from the terminal window. For example, if I type ls, nothing happens, the cursor goes to the next line and just blinks. Any idea what I’m missing? I did figure out how to attach to the container using docker exec -it /bin/sh, but I’m curious why I can’t interact through the attach command. Any help is much appreciated!

1 Like