Skip to content

Commit

Permalink
Add readme on login/logout (oras-project#60)
Browse files Browse the repository at this point in the history
* Add readme on login/logout

* Remove registry tag refs in readme
  • Loading branch information
jdolitsky authored Apr 11, 2019
1 parent 1829eb0 commit 12b336a
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The simplest way to get started is to run the official
[Docker registry image](https://hub.docker.com/_/registry) locally:

```
docker run -it --rm -p 5000:5000 registry:2.7.0
docker run -it --rm -p 5000:5000 registry
```

This will start a Distribution server at `localhost:5000`
Expand Down Expand Up @@ -99,14 +99,42 @@ docker run -it --rm -v $(pwd):/workspace orasbot/oras:v0.3.3 help

Note: the default WORKDIR in the image is `/workspace`.

### Login Credentials
`oras` uses the local Docker credentials by default. Please run `docker login` in advance for any private registries.
### Authentication

Run `oras login` in advance for any private registries. By default, this will store credentials in `~/.docker/config.json` (same file as used by Docker). If you have authenticated to a registry previously using `docker login`, the credentials will be reused. Use the `-c`/`--config` option to specify an alternate location.

`oras` also accepts explicit credentials via options, for example,
```
oras pull -u username -p password myregistry.io/myimage:latest
```

#### Example using with Docker registry

First, create a valid htpasswd file (must use `-B` for bcrypt):
```
htpasswd -cB -b auth.htpasswd myuser mypass
```

Next, start a registry using that file for auth:
```
docker run -it --rm -p 5000:5000 \
-v $(pwd)/auth.htpasswd:/etc/docker/registry/auth.htpasswd \
-e REGISTRY_AUTH="{htpasswd: {realm: localhost, path: /etc/docker/registry/auth.htpasswd}}" \
registry
```

In a new window, login with `oras`:
```
oras login -u myuser -p mypass localhost:5000
```

You will notice a new entry for `localhost:5000` appear in `~/.docker/config.json`.

To remove the entry from the credentials file, use `oras logout`:
```
oras logout localhost:5000
```

### Usage

#### Pushing single files to remote registry
Expand Down

0 comments on commit 12b336a

Please sign in to comment.