Skip to content

Commit

Permalink
registry: use "console" for shell examples
Browse files Browse the repository at this point in the history
This allows for easier copying of the commands, without selecting the
prompt.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
  • Loading branch information
thaJeztah committed Aug 6, 2021
1 parent 85730e9 commit ee8c75c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 34 deletions.
50 changes: 25 additions & 25 deletions docs/deploying.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ If you have an air-gapped datacenter, see

Use a command like the following to start the registry container:

```bash
```console
$ docker run -d -p 5000:5000 --restart=always --name registry registry:2
```

Expand All @@ -42,36 +42,36 @@ as `my-ubuntu`, then pushes it to the local registry. Finally, the

1. Pull the `ubuntu:16.04` image from Docker Hub.

```bash
```console
$ docker pull ubuntu:16.04
```

2. Tag the image as `localhost:5000/my-ubuntu`. This creates an additional tag
for the existing image. When the first part of the tag is a hostname and
port, Docker interprets this as the location of a registry, when pushing.

```bash
```console
$ docker tag ubuntu:16.04 localhost:5000/my-ubuntu
```

3. Push the image to the local registry running at `localhost:5000`:

```bash
```console
$ docker push localhost:5000/my-ubuntu
```

4. Remove the locally-cached `ubuntu:16.04` and `localhost:5000/my-ubuntu`
images, so that you can test pulling the image from your registry. This
does not remove the `localhost:5000/my-ubuntu` image from your registry.

```bash
```console
$ docker image remove ubuntu:16.04
$ docker image remove localhost:5000/my-ubuntu
```

5. Pull the `localhost:5000/my-ubuntu` image from your local registry.

```bash
```console
$ docker pull localhost:5000/my-ubuntu
```

Expand All @@ -80,13 +80,13 @@ as `my-ubuntu`, then pushes it to the local registry. Finally, the
To stop the registry, use the same `docker container stop` command as with any other
container.

```bash
```console
$ docker container stop registry
```

To remove the container, use `docker container rm`.

```bash
```console
$ docker container stop registry && docker container rm -v registry
```

Expand All @@ -105,7 +105,7 @@ should set it to restart automatically when Docker restarts or if it exits.
This example uses the `--restart always` flag to set a restart policy for the
registry.

```bash
```console
$ docker run -d \
-p 5000:5000 \
--restart=always \
Expand All @@ -122,7 +122,7 @@ port settings. This example runs the registry on port 5001 and also names it
and the second part is the port within the container. Within the container, the
registry listens on port `5000` by default.

```bash
```console
$ docker run -d \
-p 5001:5000 \
--name registry-test \
Expand All @@ -133,7 +133,7 @@ If you want to change the port the registry listens on within the container, you
can use the environment variable `REGISTRY_HTTP_ADDR` to change it. This command
causes the registry to listen on port 5001 within the container:

```bash
```console
$ docker run -d \
-e REGISTRY_HTTP_ADDR=0.0.0.0:5001 \
-p 5001:5001 \
Expand All @@ -154,7 +154,7 @@ is more dependent on the filesystem layout of the Docker host, but more performa
in many situations. The following example bind-mounts the host directory
`/mnt/registry` into the registry container at `/var/lib/registry/`.

```bash
```console
$ docker run -d \
-p 5000:5000 \
--restart=always \
Expand Down Expand Up @@ -194,7 +194,7 @@ If you have been issued an _intermediate_ certificate instead, see

1. Create a `certs` directory.

```bash
```console
$ mkdir -p certs
```

Expand All @@ -204,7 +204,7 @@ If you have been issued an _intermediate_ certificate instead, see

2. Stop the registry if it is currently running.

```bash
```console
$ docker container stop registry
```

Expand All @@ -213,7 +213,7 @@ If you have been issued an _intermediate_ certificate instead, see
environment variables that tell the container where to find the `domain.crt`
and `domain.key` file. The registry runs on port 443, the default HTTPS port.

```bash
```console
$ docker run -d \
--restart=always \
--name registry \
Expand All @@ -228,7 +228,7 @@ If you have been issued an _intermediate_ certificate instead, see
4. Docker clients can now pull from and push to your registry using its
external address. The following commands demonstrate this:

```bash
```console
$ docker pull ubuntu:16.04
$ docker tag ubuntu:16.04 myregistry.domain.com/my-ubuntu
$ docker push myregistry.domain.com/my-ubuntu
Expand All @@ -241,7 +241,7 @@ A certificate issuer may supply you with an *intermediate* certificate. In this
case, you must concatenate your certificate with the intermediate certificate to
form a *certificate bundle*. You can do this using the `cat` command:

```bash
```console
cat domain.crt intermediate-certificates.pem > certs/domain.crt
```

Expand Down Expand Up @@ -291,7 +291,7 @@ TLS certificates as in the previous examples.

First, save the TLS certificate and key as secrets:

```bash
```console
$ docker secret create domain.crt certs/domain.crt

$ docker secret create domain.key certs/domain.key
Expand All @@ -301,7 +301,7 @@ Next, add a label to the node where you want to run the registry.
To get the node's name, use `docker node ls`. Substitute your node's name for
`node1` below.

```bash
```console
$ docker node update --label-add registry=true node1
```

Expand All @@ -315,7 +315,7 @@ running the following `docker service create` command.

By default, secrets are mounted into a service at `/run/secrets/<secret-name>`.

```bash
```console
$ docker service create \
--name registry \
--secret domain.crt \
Expand Down Expand Up @@ -405,7 +405,7 @@ secrets.
1. Create a password file with one entry for the user `testuser`, with password
`testpassword`:

```bash
```console
$ mkdir auth
$ docker run \
--entrypoint htpasswd \
Expand All @@ -420,13 +420,13 @@ secrets.

2. Stop the registry.

```bash
```console
$ docker container stop registry
```

3. Start the registry with basic authentication.

```bash
```console
$ docker run -d \
-p 5000:5000 \
--restart=always \
Expand All @@ -446,7 +446,7 @@ secrets.

5. Log in to the registry.

```bash
```console
$ docker login myregistrydomain.com:5000
```

Expand Down Expand Up @@ -505,7 +505,7 @@ directories.
Start your registry by issuing the following command in the directory containing
the `docker-compose.yml` file:

```bash
```console
$ docker-compose up -d
```

Expand Down
10 changes: 5 additions & 5 deletions docs/insecure.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ This is more secure than the insecure registry solution.

1. Generate your own certificate:

```bash
```console
$ mkdir -p certs

$ openssl req \
Expand Down Expand Up @@ -130,21 +130,21 @@ certificate at the OS level.

#### Ubuntu

```bash
```console
$ cp certs/domain.crt /usr/local/share/ca-certificates/myregistrydomain.com.crt
update-ca-certificates
```

#### Red Hat Enterprise Linux

```bash
cp certs/domain.crt /etc/pki/ca-trust/source/anchors/myregistrydomain.com.crt
```console
$ cp certs/domain.crt /etc/pki/ca-trust/source/anchors/myregistrydomain.com.crt
update-ca-trust
```

#### Oracle Linux

```bash
```console
$ update-ca-trust enable
```

Expand Down
8 changes: 4 additions & 4 deletions docs/recipes/nginx.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ Review the [requirements](index.md#requirements), then follow these steps.

1. Create the required directories

```bash
mkdir -p auth data
```console
$ mkdir -p auth data
```

2. Create the main nginx configuration. Paste this code block into a new file called `auth/nginx.conf`:
Expand Down Expand Up @@ -154,15 +154,15 @@ Review the [requirements](index.md#requirements), then follow these steps.

3. Create a password file `auth/nginx.htpasswd` for "testuser" and "testpassword".

```bash
```console
$ docker run --rm --entrypoint htpasswd registry:2 -Bbn testuser testpassword > auth/nginx.htpasswd
```

> **Note**: If you do not want to use `bcrypt`, you can omit the `-B` parameter.

4. Copy your certificate files to the `auth/` directory.

```bash
```console
$ cp domain.crt auth
$ cp domain.key auth
```
Expand Down

0 comments on commit ee8c75c

Please sign in to comment.