Quit docker container that is printing in while loop without stopping it

Viewed 57

I have a docker container constantly printing "Hello world":

docker container run -d alpine sh -c 'while [ 1 ]; do echo "hello world"; sleep 1; done'

When I attach to the container to view the output, I cannot gracefully quit the container using ctrl+p ctrl+q, although this works in other containers. I see ^p gets inserted to the screen output. I can only ctrl+c, but I do not want to stop the container. Increasing the sleep timer does not help either. Is there another way to quit this container without stopping it?

0 Answers
Related