Skip to content

Commit ba54a65

Browse files
committed
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 <[email protected]>
1 parent 8599231 commit ba54a65

4 files changed

Lines changed: 25 additions & 25 deletions

File tree

develop/develop-images/baseimages.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ Assuming you built the "hello" executable example by using the source code at
7373
and you compiled it with the `-static` flag, you can build this Docker
7474
image using this `docker build` command:
7575

76-
```bash
77-
docker build --tag hello .
76+
```console
77+
$ docker build --tag hello .
7878
```
7979

8080
Don't forget the `.` character at the end, which sets the build context to the
@@ -84,7 +84,7 @@ current directory.
8484
> you need a Linux binary, rather than a Mac or Windows binary.
8585
> You can use a Docker container to build it:
8686
>
87-
> ```bash
87+
> ```console
8888
> $ docker run --rm -it -v $PWD:/build ubuntu:20.04
8989
>
9090
> container# apt-get update && apt-get install build-essential
@@ -94,8 +94,8 @@ current directory.
9494
9595
To run your new image, use the `docker run` command:
9696
97-
```bash
98-
docker run --rm hello
97+
```console
98+
$ docker run --rm hello
9999
```
100100
101101
This example creates the hello-world image used in the tutorials.

develop/develop-images/build_enhancements.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ the [Dockerfile reference](/engine/reference/builder/) page.
3737
Easiest way from a fresh install of docker is to set the `DOCKER_BUILDKIT=1`
3838
environment variable when invoking the `docker build` command, such as:
3939

40-
```bash
40+
```console
4141
$ DOCKER_BUILDKIT=1 docker build .
4242
```
4343

@@ -226,7 +226,7 @@ RUN --mount=type=ssh git clone [email protected]:myorg/myproject.git myproject
226226
Once the `Dockerfile` is created, use the `--ssh` option for connectivity with
227227
the SSH agent.
228228

229-
```bash
229+
```console
230230
$ docker build --ssh default .
231231
```
232232

develop/develop-images/dockerfile_best-practices.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -73,21 +73,21 @@ context.
7373
> a text file named `hello` and create a Dockerfile that runs `cat` on it. Build
7474
> the image from within the build context (`.`):
7575
>
76-
> ```shell
77-
> mkdir myproject && cd myproject
78-
> echo "hello" > hello
79-
> echo -e "FROM busybox\nCOPY /hello /\nRUN cat /hello" > Dockerfile
80-
> docker build -t helloapp:v1 .
76+
> ```console
77+
> $ mkdir myproject && cd myproject
78+
> $ echo "hello" > hello
79+
> $ echo -e "FROM busybox\nCOPY /hello /\nRUN cat /hello" > Dockerfile
80+
> $ docker build -t helloapp:v1 .
8181
> ```
8282
>
8383
> Move `Dockerfile` and `hello` into separate directories and build a second
8484
> version of the image (without relying on cache from the last build). Use `-f`
8585
> to point to the Dockerfile and specify the directory of the build context:
8686
>
87-
> ```shell
88-
> mkdir -p dockerfiles context
89-
> mv Dockerfile dockerfiles && mv hello context
90-
> docker build --no-cache -t helloapp:v2 -f dockerfiles/Dockerfile context
87+
> ```console
88+
> $ mkdir -p dockerfiles context
89+
> $ mv Dockerfile dockerfiles && mv hello context
90+
> $ docker build --no-cache -t helloapp:v2 -f dockerfiles/Dockerfile context
9191
> ```
9292
9393
Inadvertently including files that are not necessary for building an image
@@ -664,7 +664,7 @@ RUN echo $ADMIN_USER > ./mark
664664
RUN unset ADMIN_USER
665665
```
666666

667-
```bash
667+
```console
668668
$ docker run --rm test sh -c 'echo $ADMIN_USER'
669669

670670
mark
@@ -687,7 +687,7 @@ RUN export ADMIN_USER="mark" \
687687
CMD sh
688688
```
689689

690-
```bash
690+
```console
691691
$ docker run --rm test sh -c 'echo $ADMIN_USER'
692692

693693
```
@@ -762,13 +762,13 @@ CMD ["--help"]
762762

763763
Now the image can be run like this to show the command's help:
764764

765-
```bash
765+
```console
766766
$ docker run s3cmd
767767
```
768768

769769
Or using the right parameters to execute a command:
770770

771-
```bash
771+
```console
772772
$ docker run s3cmd ls s3://mybucket
773773
```
774774

@@ -819,19 +819,19 @@ This script allows the user to interact with Postgres in several ways.
819819

820820
It can simply start Postgres:
821821

822-
```bash
822+
```console
823823
$ docker run postgres
824824
```
825825

826826
Or, it can be used to run Postgres and pass parameters to the server:
827827

828-
```bash
828+
```console
829829
$ docker run postgres postgres --help
830830
```
831831

832832
Lastly, it could also be used to start a totally different tool, such as Bash:
833833

834-
```bash
834+
```console
835835
$ docker run --rm -it postgres bash
836836
```
837837

develop/develop-images/multistage-build.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ CMD ["./app"]
116116
You only need the single Dockerfile. You don't need a separate build script,
117117
either. Just run `docker build`.
118118

119-
```bash
119+
```console
120120
$ docker build -t alexellis2/href-counter:latest .
121121
```
122122

@@ -160,7 +160,7 @@ Dockerfile including every stage. You can specify a target build stage. The
160160
following command assumes you are using the previous `Dockerfile` but stops at
161161
the stage named `builder`:
162162

163-
```bash
163+
```console
164164
$ docker build --target builder -t alexellis2/href-counter:latest .
165165
```
166166

0 commit comments

Comments
 (0)