develop/develop-images: 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:05:48 +02:00
parent 859923171c
commit ba54a6519e
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
4 changed files with 25 additions and 25 deletions

View File

@ -73,8 +73,8 @@ Assuming you built the "hello" executable example by using the source code at
and you compiled it with the `-static` flag, you can build this Docker
image using this `docker build` command:
```bash
docker build --tag hello .
```console
$ docker build --tag hello .
```
Don't forget the `.` character at the end, which sets the build context to the
@ -84,7 +84,7 @@ current directory.
> you need a Linux binary, rather than a Mac or Windows binary.
> You can use a Docker container to build it:
>
> ```bash
> ```console
> $ docker run --rm -it -v $PWD:/build ubuntu:20.04
>
> container# apt-get update && apt-get install build-essential
@ -94,8 +94,8 @@ current directory.
To run your new image, use the `docker run` command:
```bash
docker run --rm hello
```console
$ docker run --rm hello
```
This example creates the hello-world image used in the tutorials.

View File

@ -37,7 +37,7 @@ the [Dockerfile reference](/engine/reference/builder/) page.
Easiest way from a fresh install of docker is to set the `DOCKER_BUILDKIT=1`
environment variable when invoking the `docker build` command, such as:
```bash
```console
$ DOCKER_BUILDKIT=1 docker build .
```
@ -226,7 +226,7 @@ RUN --mount=type=ssh git clone git@github.com:myorg/myproject.git myproject
Once the `Dockerfile` is created, use the `--ssh` option for connectivity with
the SSH agent.
```bash
```console
$ docker build --ssh default .
```

View File

@ -73,21 +73,21 @@ context.
> a text file named `hello` and create a Dockerfile that runs `cat` on it. Build
> the image from within the build context (`.`):
>
> ```shell
> mkdir myproject && cd myproject
> echo "hello" > hello
> echo -e "FROM busybox\nCOPY /hello /\nRUN cat /hello" > Dockerfile
> docker build -t helloapp:v1 .
> ```console
> $ mkdir myproject && cd myproject
> $ echo "hello" > hello
> $ echo -e "FROM busybox\nCOPY /hello /\nRUN cat /hello" > Dockerfile
> $ docker build -t helloapp:v1 .
> ```
>
> Move `Dockerfile` and `hello` into separate directories and build a second
> version of the image (without relying on cache from the last build). Use `-f`
> to point to the Dockerfile and specify the directory of the build context:
>
> ```shell
> mkdir -p dockerfiles context
> mv Dockerfile dockerfiles && mv hello context
> docker build --no-cache -t helloapp:v2 -f dockerfiles/Dockerfile context
> ```console
> $ mkdir -p dockerfiles context
> $ mv Dockerfile dockerfiles && mv hello context
> $ docker build --no-cache -t helloapp:v2 -f dockerfiles/Dockerfile context
> ```
Inadvertently including files that are not necessary for building an image
@ -664,7 +664,7 @@ RUN echo $ADMIN_USER > ./mark
RUN unset ADMIN_USER
```
```bash
```console
$ docker run --rm test sh -c 'echo $ADMIN_USER'
mark
@ -687,7 +687,7 @@ RUN export ADMIN_USER="mark" \
CMD sh
```
```bash
```console
$ docker run --rm test sh -c 'echo $ADMIN_USER'
```
@ -762,13 +762,13 @@ CMD ["--help"]
Now the image can be run like this to show the command's help:
```bash
```console
$ docker run s3cmd
```
Or using the right parameters to execute a command:
```bash
```console
$ docker run s3cmd ls s3://mybucket
```
@ -819,19 +819,19 @@ This script allows the user to interact with Postgres in several ways.
It can simply start Postgres:
```bash
```console
$ docker run postgres
```
Or, it can be used to run Postgres and pass parameters to the server:
```bash
```console
$ docker run postgres postgres --help
```
Lastly, it could also be used to start a totally different tool, such as Bash:
```bash
```console
$ docker run --rm -it postgres bash
```

View File

@ -116,7 +116,7 @@ CMD ["./app"]
You only need the single Dockerfile. You don't need a separate build script,
either. Just run `docker build`.
```bash
```console
$ docker build -t alexellis2/href-counter:latest .
```
@ -160,7 +160,7 @@ Dockerfile including every stage. You can specify a target build stage. The
following command assumes you are using the previous `Dockerfile` but stops at
the stage named `builder`:
```bash
```console
$ docker build --target builder -t alexellis2/href-counter:latest .
```