You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: chapters/docker-basics.adoc
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,7 @@ These instructions are stored in a file called a Dockerfile. Docker reads this D
52
52
53
53
A container consists of an operating system, user-added files, and meta-data. As we've seen, each container is built from an image. That image tells Docker what the container holds, what process to run when the container is launched, and a variety of other configuration data. The Docker image is read-only. When Docker runs a container from an image, it adds a read-write layer on top of the image (using a union file system as we saw earlier) in which your application can then run.
54
54
55
-
### Docker Machine
55
+
### Docker Machine (For Windows and Mac)
56
56
57
57
Machine makes it really easy to create Docker hosts on your computer, on cloud providers and inside your own data center. It creates servers, installs Docker on them, then configures the Docker client to talk to them.
58
58
@@ -72,7 +72,7 @@ Check if docker machine is working:
72
72
73
73
It shows the output similar to the one shown below:
74
74
75
-
docker-machine version 0.4.1 (e2c88d6)
75
+
docker-machine version 0.5.0 (04cfa58)
76
76
77
77
NOTE: The exact version may differ based upon how recently the installation was performed.
78
78
@@ -86,7 +86,7 @@ Check if your client is working using the following command:
86
86
87
87
It shows the output similar to the following:
88
88
89
-
Docker version 1.8.2, build 0a8c2e3
89
+
Docker version 1.9.0, build 76d6bc9
90
90
91
91
NOTE: The exact version may differ based upon how recently the installation was performed.
Copy file name to clipboardExpand all lines: chapters/docker-compose.adoc
+12-6Lines changed: 12 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,12 +28,12 @@ An application using Docker containers will typically consist of multiple contai
28
28
29
29
NOTE: According to https://docs.docker.com/compose/install/ "You can run Compose on OS X and 64-bit Linux. It is currently not supported on the Windows operating system."
Copy file name to clipboardExpand all lines: chapters/docker-container.adoc
+3-4Lines changed: 3 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,7 @@ We call the union of the read-write layer and all the read-only layers a _union
47
47
image::images/plain-wildfly0.png[]
48
48
====
49
49
50
-
In our particular case, the https://github.com/jboss-dockerfiles/wildfly/blob/9.0.1.Final/Dockerfile[jboss/wildfly] image extends the https://github.com/jboss-dockerfiles/base-jdk/blob/jdk8/Dockerfile[jboss/base-jdk:8] image which adds the OpenJDK distribution on top of the https://github.com/jboss-dockerfiles/base/blob/master/Dockerfile[jboss/base] image.
50
+
In our particular case, the https://github.com/jboss-dockerfiles/wildfly/blob/9.0.2.Final/Dockerfile[jboss/wildfly] image extends the https://github.com/jboss-dockerfiles/base-jdk/blob/jdk8/Dockerfile[jboss/base-jdk:8] image which adds the OpenJDK distribution on top of the https://github.com/jboss-dockerfiles/base/blob/master/Dockerfile[jboss/base] image.
51
51
The base image is used for all JBoss community images. It provides a base layer that includes:
52
52
53
53
. A jboss user (uid/gid 1000) with home directory set to `/opt/jboss`
@@ -65,7 +65,6 @@ When the download is done, you can list the images again and will see the follow
65
65
docker images
66
66
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
67
67
jboss/wildfly latest 7688aaf382ab 6 weeks ago 581.4 MB
68
-
swarm latest 207e8b983242 9 weeks ago 10.2 MB
69
68
----
70
69
71
70
### Run Container
@@ -104,7 +103,7 @@ This will show the output as:
104
103
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
105
104
17:02:58,000 INFO [org.jboss.modules] (main) JBoss Modules version 1.4.3.Final
106
105
17:02:58,251 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
107
-
17:02:58,311 INFO [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: WildFly Full 9.0.1.Final (WildFly Core 1.0.1.Final) starting
106
+
17:02:58,311 INFO [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: WildFly Full 9.0.2.Final (WildFly Core 1.0.2.Final) starting
108
107
17:02:59,558 INFO [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 11) WFLYCTL0028: Attribute 'job-repository-type' in the resource at address '/subsystem=batch' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
109
108
17:02:59,560 INFO [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 3) WFLYCTL0028: Attribute 'enabled' in the resource at address '/subsystem=datasources/data-source=ExampleDS' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
110
109
...
@@ -114,7 +113,7 @@ OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was
114
113
17:03:00,891 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-2) WFLYDS0013: Started FileSystemDeploymentService for directory /opt/jboss/wildfly/standalone/deployments
115
114
17:03:01,131 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
116
115
17:03:01,133 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
117
-
17:03:01,138 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 9.0.1.Final (WildFly Core 1.0.1.Final) started in 3431ms - Started 203 of 379 services (210 services are lazy, passive or on-demand)
116
+
17:03:01,138 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 9.0.2.Final (WildFly Core 1.0.2.Final) started in 3431ms - Started 203 of 379 services (210 services are lazy, passive or on-demand)
118
117
----
119
118
120
119
This shows that the server started correctly, congratulations!
Copy file name to clipboardExpand all lines: chapters/docker-deployment-options.adoc
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -88,9 +88,9 @@ image::images/jbds1.png[]
88
88
.WildFly Runtime Properties
89
89
image::images/jbds2.png[]
90
90
+
91
-
. If a new runtime needs to be created, pick the directory for WildFly 9.0.1:
91
+
. If a new runtime needs to be created, pick the directory for WildFly 9.0.2:
92
92
+
93
-
.WildFly 9.0.1.Final Runtime
93
+
.WildFly 9.0.2.Final Runtime
94
94
image::images/jbds3.png[]
95
95
+
96
96
Click on '`Finish`'.
@@ -141,7 +141,7 @@ TThe Command Line Interface (CLI) is a tool for connecting to WildFly instances
141
141
142
142
Lets use the CLI to deploy javaee7-simple-sample to WildFly running in the container.
143
143
144
-
. CLI needs to be locally installed and comes as part of WildFly. This should be available in the previously downloaded WildFly. Unzip into a folder of your choice (e.g. `/Users/<USER>/tools/`). This will create `wildfly-9.0.0.Final` directory here. This folder is referred to $WIDLFY_HOME from here on. Make sure to add the `/Users/<USER>/tools/wildfly-9.0.0.Final/bin` to your $PATH.
144
+
. CLI needs to be locally installed and comes as part of WildFly. This should be available in the previously downloaded WildFly. Unzip into a folder of your choice (e.g. `/Users/<USER>/tools/`). This will create `wildfly-9.0.2.Final` directory here. This folder is referred to $WIDLFY_HOME from here on. Make sure to add the `/Users/<USER>/tools/wildfly-9.0.2.Final/bin` to your $PATH.
145
145
+
146
146
. Run the "`wildfly-management`" image with fixed port mapping as explained in <<Management_Fixed_Port_Mapping>>.
147
147
. Run the `jboss-cli` command and connect to the WildFly instance.
In addition to application port 8080, the administration port 9990 is exposed as well. The WildFly image that is used has tweaked the start script such that the management interface is bound to 0.0.0.0.
242
242
+
243
-
. Create a new server adapter in JBoss Developer Studio and name it "`WildFly 9.0.0-Management`". Specify the host name as '`dockerhost`'.
243
+
. Create a new server adapter in JBoss Developer Studio and name it "`WildFly 9.0.2-Management`". Specify the host name as '`dockerhost`'.
@@ -28,149 +28,97 @@ _Dockerfile_ is usually called _Dockerfile_. The complete list of commands that
28
28
29
29
. Create a new directory.
30
30
. Create a new text file, name it _Dockerfile_, and use the following contents:
31
-
+
31
+
32
32
[source, text]
33
33
----
34
-
FROM ubuntu
34
+
#From Internet
35
+
FROM fedora
36
+
37
+
#From Instructor
38
+
FROM classroom.example.com:5000/fedora
35
39
36
40
CMD ["/bin/echo", "hello world"]
37
41
----
38
-
+
39
-
This image uses `ubuntu` as the base image. `CMD` command defines the command that needs to run. It provides a different entry point of `/bin/echo` and gives the argument "`hello world`".
40
-
+
42
+
43
+
This image uses `fedora` as the base image. `CMD` command defines the command that needs to run. It provides a different entry point of `/bin/echo` and gives the argument "`hello world`".
RUN curl -L https://github.com/javaee-samples/javaee7-hol/raw/master/solution/movieplex7-1.0-SNAPSHOT.war -o /opt/jboss/wildfly/standalone/deployments/movieplex7-1.0-SNAPSHOT.war <3>
124
-
----
125
-
+
126
-
Three things in this image:
127
-
+
128
-
<1> Uses "`jboss/wildfly`" as the base image
129
-
<2> Starts WildFly application server in Full Platform mode
130
-
<3> Copies the WAR file from from a URL to the deployment directory of WildFly
131
-
+
132
112
. Build the image:
133
113
134
-
docker build -t movieplex .
135
-
136
-
=== Dockerfile Command Design Patterns
137
-
138
-
==== Difference between CMD and ENTRYPOINT
139
-
140
-
*TL;DR* `CMD` will work for most of the cases.
141
-
142
-
Default entry point for a container is `/bin/sh`, the default shell.
143
-
144
-
Running a container as `docker run -it ubuntu` uses that command and starts the default shell. The output is shown as:
145
-
146
-
```console
147
-
> docker run -it ubuntu
148
-
root@88976ddee107:/#
149
-
```
150
-
151
-
`ENTRYPOINT` allows to override the entry point to some other command, and even customize it. For example, a container can be started as:
152
-
153
-
```console
154
-
> docker run -it --entrypoint=/bin/cat ubuntu /etc/passwd
155
-
root:x:0:0:root:/root:/bin/bash
156
-
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
157
-
bin:x:2:2:bin:/bin:/usr/sbin/nologin
158
-
sys:x:3:3:sys:/dev:/usr/sbin/nologin
159
-
. . .
160
-
```
161
-
162
-
This command overrides the entry point to the container to `/bin/cat`. The argument(s) passed to the CLI are used by the entry point.
163
-
164
-
==== Difference between ADD and COPY
114
+
docker build -t mywildfly .
165
115
166
-
*TL;DR* `COPY` will work for most of the cases.
116
+
. Run the container:
167
117
168
-
`ADD` has all capabilities of `COPY` and has the following additional features:
118
+
docker run -it mywildfly
169
119
170
-
. Allows tar file auto-extraction in the image, for example, `ADD app.tar.gz /opt/var/myapp`.
171
-
. Allows files to be downloaded from a remote URL. However, the downloaded files will become part of the image. This causes the image size to bloat. So its recommended to use `curl` or `wget` to download the archive explicitly, extract, and remove the archive.
172
120
173
-
==== Import and export images
121
+
=== Import and export images
174
122
175
123
Docker images can be saved using `save` command to a .tar file:
0 commit comments