Net Core Full Stack
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 ?
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!
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.
- docker run -d -p 8080:80 dockerhub_username/dockerhub_repo
Hope that this helps! Regards, Alex
Hello,
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:
Best,
Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.