github.com/flavio/docker@v0.1.3-0.20170117145210-f63d1a6eec47/docs/reference/commandline/login.md (about)

     1  ---
     2  title: "login"
     3  description: "The login command description and usage"
     4  keywords: "registry, login, image"
     5  ---
     6  
     7  <!-- This file is maintained within the docker/docker Github
     8       repository at https://github.com/docker/docker/. Make all
     9       pull requests against that repo. If you see this file in
    10       another repository, consider it read-only there, as it will
    11       periodically be overwritten by the definitive file. Pull
    12       requests which include edits to this file in other repositories
    13       will be rejected.
    14  -->
    15  
    16  # login
    17  
    18  ```markdown
    19  Usage:  docker login [OPTIONS] [SERVER]
    20  
    21  Log in to a Docker registry.
    22  If no server is specified, the default is defined by the daemon.
    23  
    24  Options:
    25        --help              Print usage
    26    -p, --password string   Password
    27    -u, --username string   Username
    28  ```
    29  
    30  If you want to login to a self-hosted registry you can specify this by
    31  adding the server name.
    32  
    33      example:
    34      $ docker login localhost:8080
    35  
    36  
    37  `docker login` requires user to use `sudo` or be `root`, except when:
    38  
    39  1.  connecting to a remote daemon, such as a `docker-machine` provisioned `docker engine`.
    40  2.  user is added to the `docker` group.  This will impact the security of your system; the `docker` group is `root` equivalent.  See [Docker Daemon Attack Surface](https://docs.docker.com/security/security/#docker-daemon-attack-surface) for details.
    41  
    42  You can log into any public or private repository for which you have
    43  credentials.  When you log in, the command stores encoded credentials in
    44  `$HOME/.docker/config.json` on Linux or `%USERPROFILE%/.docker/config.json` on Windows.
    45  
    46  ## Credentials store
    47  
    48  The Docker Engine can keep user credentials in an external credentials store,
    49  such as the native keychain of the operating system. Using an external store
    50  is more secure than storing credentials in the Docker configuration file.
    51  
    52  To use a credentials store, you need an external helper program to interact
    53  with a specific keychain or external store. Docker requires the helper
    54  program to be in the client's host `$PATH`.
    55  
    56  This is the list of currently available credentials helpers and where
    57  you can download them from:
    58  
    59  - D-Bus Secret Service: https://github.com/docker/docker-credential-helpers/releases
    60  - Apple macOS keychain: https://github.com/docker/docker-credential-helpers/releases
    61  - Microsoft Windows Credential Manager: https://github.com/docker/docker-credential-helpers/releases
    62  
    63  ### Usage
    64  
    65  You need to specify the credentials store in `$HOME/.docker/config.json`
    66  to tell the docker engine to use it. The value of the config property should be
    67  the suffix of the program to use (i.e. everything after `docker-credential-`).
    68  For example, to use `docker-credential-osxkeychain`:
    69  
    70  ```json
    71  {
    72  	"credsStore": "osxkeychain"
    73  }
    74  ```
    75  
    76  If you are currently logged in, run `docker logout` to remove
    77  the credentials from the file and run `docker login` again.
    78  
    79  ### Protocol
    80  
    81  Credential helpers can be any program or script that follows a very simple protocol.
    82  This protocol is heavily inspired by Git, but it differs in the information shared.
    83  
    84  The helpers always use the first argument in the command to identify the action.
    85  There are only three possible values for that argument: `store`, `get`, and `erase`.
    86  
    87  The `store` command takes a JSON payload from the standard input. That payload carries
    88  the server address, to identify the credential, the user name, and either a password
    89  or an identity token.
    90  
    91  ```json
    92  {
    93  	"ServerURL": "https://index.docker.io/v1",
    94  	"Username": "david",
    95  	"Secret": "passw0rd1"
    96  }
    97  ```
    98  
    99  If the secret being stored is an identity token, the Username should be set to
   100  `<token>`.
   101  
   102  The `store` command can write error messages to `STDOUT` that the docker engine
   103  will show if there was an issue.
   104  
   105  The `get` command takes a string payload from the standard input. That payload carries
   106  the server address that the docker engine needs credentials for. This is
   107  an example of that payload: `https://index.docker.io/v1`.
   108  
   109  The `get` command writes a JSON payload to `STDOUT`. Docker reads the user name
   110  and password from this payload:
   111  
   112  ```json
   113  {
   114  	"Username": "david",
   115  	"Secret": "passw0rd1"
   116  }
   117  ```
   118  
   119  The `erase` command takes a string payload from `STDIN`. That payload carries
   120  the server address that the docker engine wants to remove credentials for. This is
   121  an example of that payload: `https://index.docker.io/v1`.
   122  
   123  The `erase` command can write error messages to `STDOUT` that the docker engine
   124  will show if there was an issue.
   125  
   126  ## Credential helpers
   127  
   128  Credential helpers are similar to the credential store above, but act as the
   129  designated programs to handle credentials for *specific registries*. The default
   130  credential store (`credsStore` or the config file itself) will not be used for
   131  operations concerning credentials of the specified registries.
   132  
   133  ### Usage
   134  
   135  If you are currently logged in, run `docker logout` to remove
   136  the credentials from the default store.
   137  
   138  Credential helpers are specified in a similar way to `credsStore`, but
   139  allow for multiple helpers to be configured at a time. Keys specify the
   140  registry domain, and values specify the suffix of the program to use
   141  (i.e. everything after `docker-credential-`).
   142  For example:
   143  
   144  ```json
   145  {
   146    "credHelpers": {
   147      "registry.example.com": "registryhelper",
   148      "awesomereg.example.org": "hip-star",
   149      "unicorn.example.io": "vcbait"
   150    }
   151  }
   152  ```