Note Ctrl+Z suspends a foreground job. bg resumes it in the background. fg brings a background job to the foreground. jobs lists all jobs for the current shell session. %1 refers to job number 1.
Note Runs the container in the background and prints the container ID. Use docker logs to see its output. Without -d, your terminal is attached and Ctrl+C stops the container.
Frequently asked questions
How do you run background?
This task is covered in 2 stacks on this page: Bash & Linux, Docker. The "Background, Foreground & Job List" snippet in Bash & Linux uses `command &`.
Which command does the Bash & Linux example use?
The "Background, Foreground & Job List" snippet uses `command &`, from the Process Management section of the Bash & Linux cheat sheet.
Which stacks cover "run background" on this page?
Bash & Linux, Docker. Together they hold 2 copy-ready snippets for this task.
Is there anything to watch out for?
Yes. For "Background, Foreground & Job List": Ctrl+Z suspends a foreground job. bg resumes it in the background. fg brings a background job to the foreground. jobs lists all jobs for the current shell session. %1 refers to job number 1.