1
0
mirror of https://github.com/moby/moby.git synced 2025-12-12 10:01:33 +03:00
Files
moby/docs/sources/examples/running_examples.rst

1.0 KiB

title
Running the Examples
description
An overview on how to run the docker examples
keywords
docker, examples, how to

Running The Examples

There are two ways to run docker, daemon mode and standalone mode.

When you run the docker command it will first check if there is a docker daemon running in the background it can connect to.

  • If it exists it will use that daemon to run all of the commands.
  • If it does not exist docker will run in standalone mode (docker will exit after each command).

Docker needs to be run from a privileged account (root).

  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.

    # starting docker daemon in the background
    sudo docker -d &
    
    # now you can run docker commands from any account.
    docker <command>
  2. Standalone: You need to run every command as root, or using sudo

    sudo docker <command>