I need a help when I use ‘exec’ and ctrl+P+Q

When I use ubuntu in docker, I do that:

  1. run ‘docker run -it --name ubuntu ubuntu’. then install gcc and type ctrl+P+Q when compile my code.
  2. run ‘docker exec -it ubuntu /bin/bash’. then compile my another code and type ctrl+P+Q.
  3. run ‘docker exec -it ubuntu /bin/bash’. then do another things…
    now, how to get into 1st screen? tellgamestop

Well, I never knew about Ctrl+P+Q, so cheers on giving me something to look up and learn about. Of some use to me was this: https://stackoverflow.com/questions/19688314/how-do-you-attach-and-detach-from-dockers-process

I’m not 100% sure what you mean about “first screen”, but the accepted answer in that link says: docker run -t -i → can be detached with ^P^Q and reattached with docker attach. So maybe you want to use “docker attach ubuntu” instead of “docker exec -it ubuntu /bin/bash”.