samples: use "console" for shell examples

This allows for easier copying of the commands, without selecting the
prompt.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2021-08-06 17:01:54 +02:00
parent 07f67f5c72
commit 051a690f64
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
5 changed files with 24 additions and 24 deletions

View File

@ -40,20 +40,20 @@ CMD chmod 777 /var/cache/apt-cacher-ng && /etc/init.d/apt-cacher-ng start &&
To build the image using: To build the image using:
```bash ```console
$ docker build -t eg_apt_cacher_ng . $ docker build -t eg_apt_cacher_ng .
``` ```
Then run it, mapping the exposed port to one on the host Then run it, mapping the exposed port to one on the host
```bash ```console
$ docker run -d -p 3142:3142 --name test_apt_cacher_ng eg_apt_cacher_ng $ docker run -d -p 3142:3142 --name test_apt_cacher_ng eg_apt_cacher_ng
``` ```
To see the logfiles that are `tailed` in the default command, you can To see the logfiles that are `tailed` in the default command, you can
use: use:
```bash ```console
$ docker logs -f test_apt_cacher_ng $ docker logs -f test_apt_cacher_ng
``` ```
@ -86,7 +86,7 @@ RUN apt-get update && apt-get install -y vim git
**Option 2** is good for testing, but breaks other HTTP clients **Option 2** is good for testing, but breaks other HTTP clients
which obey `http_proxy`, such as `curl`, `wget` and others: which obey `http_proxy`, such as `curl`, `wget` and others:
```bash ```console
$ docker run --rm -t -i -e http_proxy=http://dockerhost:3142/ debian bash $ docker run --rm -t -i -e http_proxy=http://dockerhost:3142/ debian bash
``` ```
@ -95,13 +95,13 @@ from your `Dockerfile` too.
**Option 4** links Debian-containers to the proxy server using following command: **Option 4** links Debian-containers to the proxy server using following command:
```bash ```console
$ docker run -i -t --link test_apt_cacher_ng:apt_proxy -e http_proxy=http://apt_proxy:3142/ debian bash $ docker run -i -t --link test_apt_cacher_ng:apt_proxy -e http_proxy=http://apt_proxy:3142/ debian bash
``` ```
**Option 5** creates a custom network of APT proxy server and Debian-based containers: **Option 5** creates a custom network of APT proxy server and Debian-based containers:
```bash ```console
$ docker network create mynetwork $ docker network create mynetwork
$ docker run -d -p 3142:3142 --network=mynetwork --name test_apt_cacher_ng eg_apt_cacher_ng $ docker run -d -p 3142:3142 --network=mynetwork --name test_apt_cacher_ng eg_apt_cacher_ng
$ docker run --rm -it --network=mynetwork -e http_proxy=http://test_apt_cacher_ng:3142/ debian bash $ docker run --rm -it --network=mynetwork -e http_proxy=http://test_apt_cacher_ng:3142/ debian bash
@ -111,7 +111,7 @@ Apt-cacher-ng has some tools that allow you to manage the repository,
and they can be used by leveraging the `VOLUME` and they can be used by leveraging the `VOLUME`
instruction, and the image we built to run the service: instruction, and the image we built to run the service:
```bash ```console
$ docker run --rm -t -i --volumes-from test_apt_cacher_ng eg_apt_cacher_ng bash $ docker run --rm -t -i --volumes-from test_apt_cacher_ng eg_apt_cacher_ng bash
root@f38c87f2a42d:/# /usr/lib/apt-cacher-ng/distkill.pl root@f38c87f2a42d:/# /usr/lib/apt-cacher-ng/distkill.pl
@ -137,7 +137,7 @@ WARNING: The removal action may wipe out whole directories containing
Finally, clean up after your test by stopping and removing the Finally, clean up after your test by stopping and removing the
container, and then removing the image. container, and then removing the image.
```bash ```console
$ docker container stop test_apt_cacher_ng $ docker container stop test_apt_cacher_ng
$ docker container rm test_apt_cacher_ng $ docker container rm test_apt_cacher_ng
$ docker image rm eg_apt_cacher_ng $ docker image rm eg_apt_cacher_ng

View File

@ -35,7 +35,7 @@ configure this app to use our SQL Server database, and then create a
sample web application within the container under the `/app` directory and sample web application within the container under the `/app` directory and
into your host machine in the working directory: into your host machine in the working directory:
```bash ```console
$ docker run -v ${PWD}:/app --workdir /app microsoft/dotnet:2.1-sdk dotnet new mvc --auth Individual $ docker run -v ${PWD}:/app --workdir /app microsoft/dotnet:2.1-sdk dotnet new mvc --auth Individual
``` ```
@ -170,7 +170,7 @@ configure this app to use our SQL Server database, and then create a
1. Ready! You can now run the `docker-compose build` command. 1. Ready! You can now run the `docker-compose build` command.
```bash ```console
$ docker-compose build $ docker-compose build
``` ```
@ -185,7 +185,7 @@ configure this app to use our SQL Server database, and then create a
sample website. The application is listening on port 80 by default, but we sample website. The application is listening on port 80 by default, but we
mapped it to port 8000 in the `docker-compose.yml`. mapped it to port 8000 in the `docker-compose.yml`.
```bash ```console
$ docker-compose up $ docker-compose up
``` ```

View File

@ -18,7 +18,7 @@ different versions of CouchDB on the same data, etc.
We're marking `/var/lib/couchdb` as a data volume. We're marking `/var/lib/couchdb` as a data volume.
```bash ```console
$ COUCH1=$(docker run -d -p 5984 -v /var/lib/couchdb shykes/couchdb:2013-05-03) $ COUCH1=$(docker run -d -p 5984 -v /var/lib/couchdb shykes/couchdb:2013-05-03)
``` ```
@ -27,7 +27,7 @@ $ COUCH1=$(docker run -d -p 5984 -v /var/lib/couchdb shykes/couchdb:2013-05-03)
We're assuming your Docker host is reachable at `localhost`. If not, We're assuming your Docker host is reachable at `localhost`. If not,
replace `localhost` with the public IP of your Docker host. replace `localhost` with the public IP of your Docker host.
```bash ```console
$ HOST=localhost $ HOST=localhost
$ URL="http://$HOST:$(docker port $COUCH1 5984 | grep -o '[1-9][0-9]*$')/_utils/" $ URL="http://$HOST:$(docker port $COUCH1 5984 | grep -o '[1-9][0-9]*$')/_utils/"
$ echo "Navigate to $URL in your browser, and use the couch interface to add data" $ echo "Navigate to $URL in your browser, and use the couch interface to add data"
@ -37,13 +37,13 @@ $ echo "Navigate to $URL in your browser, and use the couch interface to add dat
This time, we're requesting shared access to `$COUCH1`'s volumes. This time, we're requesting shared access to `$COUCH1`'s volumes.
```bash ```console
$ COUCH2=$(docker run -d -p 5984 --volumes-from $COUCH1 shykes/couchdb:2013-05-03) $ COUCH2=$(docker run -d -p 5984 --volumes-from $COUCH1 shykes/couchdb:2013-05-03)
``` ```
## Browse data on the second database ## Browse data on the second database
```bash ```console
$ HOST=localhost $ HOST=localhost
$ URL="http://$HOST:$(docker port $COUCH2 5984 | grep -o '[1-9][0-9]*$')/_utils/" $ URL="http://$HOST:$(docker port $COUCH2 5984 | grep -o '[1-9][0-9]*$')/_utils/"
$ echo "Navigate to $URL in your browser. You should see the same data as in the first database"'!' $ echo "Navigate to $URL in your browser. You should see the same data as in the first database"'!'

View File

@ -68,13 +68,13 @@ CMD ["/usr/lib/postgresql/9.3/bin/postgres", "-D", "/var/lib/postgresql/9.3/main
Build an image from the Dockerfile and assign it a name. Build an image from the Dockerfile and assign it a name.
```bash ```console
$ docker build -t eg_postgresql . $ docker build -t eg_postgresql .
``` ```
Run the PostgreSQL server container (in the foreground): Run the PostgreSQL server container (in the foreground):
```bash ```console
$ docker run --rm -P --name pg_test eg_postgresql $ docker run --rm -P --name pg_test eg_postgresql
``` ```
@ -92,7 +92,7 @@ Containers can be linked to another container's ports directly using
`docker run`. This sets a number of environment `docker run`. This sets a number of environment
variables that can then be used to connect: variables that can then be used to connect:
```bash ```console
$ docker run --rm -t -i --link pg_test:pg eg_postgresql bash $ docker run --rm -t -i --link pg_test:pg eg_postgresql bash
postgres@7ef98b1b7243:/$ psql -h $PG_PORT_5432_TCP_ADDR -p $PG_PORT_5432_TCP_PORT -d docker -U docker --password postgres@7ef98b1b7243:/$ psql -h $PG_PORT_5432_TCP_ADDR -p $PG_PORT_5432_TCP_PORT -d docker -U docker --password
@ -105,7 +105,7 @@ host-mapped port to test as well. You need to use `docker ps`
to find out what local host port the container is mapped to to find out what local host port the container is mapped to
first: first:
```bash ```console
$ docker ps $ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
@ -142,7 +142,7 @@ $ docker=# select * from cities;
You can use the defined volumes to inspect the PostgreSQL log files and You can use the defined volumes to inspect the PostgreSQL log files and
to backup your configuration and data: to backup your configuration and data:
```bash ```console
$ docker run --rm --volumes-from pg_test -t -i busybox sh $ docker run --rm --volumes-from pg_test -t -i busybox sh
/ # ls / # ls

View File

@ -13,7 +13,7 @@ Riak pre-installed.
Create an empty file called `Dockerfile`: Create an empty file called `Dockerfile`:
```bash ```console
$ touch Dockerfile $ touch Dockerfile
``` ```
@ -84,8 +84,8 @@ CMD ["/usr/bin/supervisord"]
Create an empty file called `supervisord.conf`. Make Create an empty file called `supervisord.conf`. Make
sure it's at the same directory level as your `Dockerfile`: sure it's at the same directory level as your `Dockerfile`:
```bash ```console
touch supervisord.conf $ touch supervisord.conf
``` ```
Populate it with the following program definitions: Populate it with the following program definitions:
@ -109,7 +109,7 @@ stderr_logfile=/var/log/supervisor/%(program_name)s.log
Now you can build a Docker image for Riak: Now you can build a Docker image for Riak:
```bash ```console
$ docker build -t "<yourname>/riak" . $ docker build -t "<yourname>/riak" .
``` ```