mirror of https://github.com/docker/docs.git
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:
parent
07f67f5c72
commit
051a690f64
|
@ -40,20 +40,20 @@ CMD chmod 777 /var/cache/apt-cacher-ng && /etc/init.d/apt-cacher-ng start &&
|
|||
|
||||
To build the image using:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker build -t eg_apt_cacher_ng .
|
||||
```
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
To see the logfiles that are `tailed` in the default command, you can
|
||||
use:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ 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
|
||||
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
|
||||
```
|
||||
|
||||
|
@ -95,13 +95,13 @@ from your `Dockerfile` too.
|
|||
|
||||
**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
|
||||
```
|
||||
|
||||
**Option 5** creates a custom network of APT proxy server and Debian-based containers:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker network create mynetwork
|
||||
$ 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
|
||||
|
@ -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`
|
||||
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
|
||||
|
||||
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
|
||||
container, and then removing the image.
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker container stop test_apt_cacher_ng
|
||||
$ docker container rm test_apt_cacher_ng
|
||||
$ docker image rm eg_apt_cacher_ng
|
||||
|
|
|
@ -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
|
||||
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
|
||||
```
|
||||
|
||||
|
@ -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.
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ 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
|
||||
mapped it to port 8000 in the `docker-compose.yml`.
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker-compose up
|
||||
```
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ different versions of CouchDB on the same data, etc.
|
|||
|
||||
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)
|
||||
```
|
||||
|
||||
|
@ -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,
|
||||
replace `localhost` with the public IP of your Docker host.
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ HOST=localhost
|
||||
$ 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"
|
||||
|
@ -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.
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ COUCH2=$(docker run -d -p 5984 --volumes-from $COUCH1 shykes/couchdb:2013-05-03)
|
||||
```
|
||||
|
||||
## Browse data on the second database
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ HOST=localhost
|
||||
$ 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"'!'
|
||||
|
|
|
@ -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.
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker build -t eg_postgresql .
|
||||
```
|
||||
|
||||
Run the PostgreSQL server container (in the foreground):
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ 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
|
||||
variables that can then be used to connect:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ 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
|
||||
|
@ -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
|
||||
first:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker ps
|
||||
|
||||
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
|
||||
to backup your configuration and data:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker run --rm --volumes-from pg_test -t -i busybox sh
|
||||
|
||||
/ # ls
|
||||
|
|
|
@ -13,7 +13,7 @@ Riak pre-installed.
|
|||
|
||||
Create an empty file called `Dockerfile`:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ touch Dockerfile
|
||||
```
|
||||
|
||||
|
@ -84,8 +84,8 @@ CMD ["/usr/bin/supervisord"]
|
|||
Create an empty file called `supervisord.conf`. Make
|
||||
sure it's at the same directory level as your `Dockerfile`:
|
||||
|
||||
```bash
|
||||
touch supervisord.conf
|
||||
```console
|
||||
$ touch supervisord.conf
|
||||
```
|
||||
|
||||
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:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker build -t "<yourname>/riak" .
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in New Issue