After I run a docker run command it gets stuck indefinitely

Hi! I have an ubuntu droplet setup. I run the command “docker run -p 8080:80 dockerhub_username/dockerhub_repo”. After this command the terminal gets stuck indefinitely, and i cannot perform any other actions unless i press ctrl + c. How may I make this work ?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.


Indeed as Alex already mentioned, if you do not specify the -d flag the container will run in the foreground so that whenever you press CTRL+C or close your terminal the container will be terminated.

For more information on getting started with Docker, I could also suggest the following open-source ebook:



Hello there,

You can add the -d flag in order to run the docker container in the background.

To run a docker container in the background or the detached mode from the terminal, you can use the docker run command followed by the -d flag (or detached flag) and followed by the name of the docker image you need to use in the terminal.

  1. docker run -d -p 8080:80 dockerhub_username/dockerhub_repo

Hope that this helps! Regards, Alex