Skip to content

Commit c1d80d9

Browse files
committed
resolving conflict
1 parent bd02ac8 commit c1d80d9

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

developer-tools/java/chapters/ch03-build-image.adoc

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
== Dockerfile
1010

11-
Docker build images by reading instructions from a _Dockerfile_. A _Dockerfile_ is a text document that contains all the commands a user could call on the command line to assemble an image. `docker build` command uses this file and executes all the commands in succession to create an image.
11+
Docker build images by reading instructions from a _Dockerfile_. A _Dockerfile_ is a text document that contains all the commands a user could call on the command line to assemble an image. `docker image build` command uses this file and executes all the commands in succession to create an image.
1212

1313
`build` command is also passed a context that is used during image creation. This context can be a path on your local filesystem or a URL to a Git repository.
1414

@@ -96,7 +96,7 @@ If you do not see the expected output, check your Dockerfile that the content ex
9696

9797
Change the base image from `ubuntu` to `busybox` in `Dockerfile`. Build the image again:
9898

99-
docker build -t helloworld:2 .
99+
docker image build -t helloworld:2 .
100100

101101
and view the images using `docker image ls` command:
102102

@@ -172,10 +172,7 @@ Let's package this application as a Docker image.
172172

173173
Run the OpenJDK container in an interactive manner:
174174

175-
[source, text]
176-
----
177-
docker run -it openjdk
178-
----
175+
docker container run -it openjdk
179176

180177
This will open a terminal in the container. Check the version of Java:
181178

@@ -206,11 +203,11 @@ CMD java -cp /usr/src/helloworld-1.0-SNAPSHOT.jar org.examples.java.App
206203

207204
Build the image:
208205

209-
docker build -t hello-java:latest .
206+
docker image build -t hello-java:latest .
210207

211208
Run the image:
212209

213-
docker run hello-java:latest
210+
docker container run hello-java:latest
214211

215212
This displays the output:
216213

@@ -274,7 +271,7 @@ This will show an output like:
274271
[INFO] DOCKER> [hellojava:latest]: Waited on log out 'Hello World!' 510 ms
275272
----
276273

277-
This is similar output when running the Java application using `java` CLI or the Docker container using `docker run` command.
274+
This is similar output when running the Java application using `java` CLI or the Docker container using `docker container run` command.
278275

279276
The container is running in the foreground. Use `Ctrl` + `C` to interrupt the container and return back to terminal.
280277

@@ -342,17 +339,17 @@ Only one change was required in the project to enable Docker packaging and runni
342339

343340
Default entry point for a container is `/bin/sh`, the default shell.
344341

345-
Running a container as `docker run -it ubuntu` uses that command and starts the default shell. The output is shown as:
342+
Running a container as `docker container run -it ubuntu` uses that command and starts the default shell. The output is shown as:
346343

347344
```console
348-
> docker run -it ubuntu
345+
> docker container run -it ubuntu
349346
root@88976ddee107:/#
350347
```
351348

352349
`ENTRYPOINT` allows to override the entry point to some other command, and even customize it. For example, a container can be started as:
353350

354351
```console
355-
> docker run -it --entrypoint=/bin/cat ubuntu /etc/passwd
352+
> docker container run -it --entrypoint=/bin/cat ubuntu /etc/passwd
356353
root:x:0:0:root:/root:/bin/bash
357354
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
358355
bin:x:2:2:bin:/bin:/usr/sbin/nologin

0 commit comments

Comments
 (0)