running_examples.rst 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. :title: Running the Examples
  2. :description: An overview on how to run the docker examples
  3. :keywords: docker, examples, how to
  4. .. _running_examples:
  5. Running The Examples
  6. --------------------
  7. There are two ways to run docker, daemon mode and standalone mode.
  8. When you run the docker command it will first check if there is a docker daemon running in the background it can connect to.
  9. * If it exists it will use that daemon to run all of the commands.
  10. * If it does not exist docker will run in standalone mode (docker will exit after each command).
  11. Docker needs to be run from a privileged account (root).
  12. 1. The most common (and recommended) way is to run a docker daemon as root in the background, and then connect to it from the docker client from any account.
  13. .. code-block:: bash
  14. # starting docker daemon in the background
  15. sudo docker -d &
  16. # now you can run docker commands from any account.
  17. docker <command>
  18. 2. Standalone: You need to run every command as root, or using sudo
  19. .. code-block:: bash
  20. sudo docker <command>