Статьи

Создайте свой собственный образ Docker (Tech Tip # 57)

Docker упрощает доставку программного обеспечения, позволяя легко создавать и обмениваться изображениями, которые содержат всю среду вашего приложения, то есть операционную систему, JDK, базу данных, файл WAR, особую настройку, требуемую для вашего приложения, и т. Д.

Есть три основных компонента Docker:

  • Образы Docker являются «компонентом сборки» — доступным только для чтения шаблоном операционной системы приложения.
  • Контейнеры являются «компонентом запуска» — представлением времени выполнения, созданным из изображений.
  • Реестр является «компонентом распространения» — местом для хранения и распространения изображений.

Несколько проектов JBoss доступны в виде изображений Docker на сайте www.jboss.org/docker . Технический совет № 39 объяснил, как начать работу с Docker на Mac. Также объясняется, как запустить официальное изображение WildFly Docker .

Изображение Docker состоит из нескольких слоев, каждый из которых обеспечивает определенную функциональность, и более высокий уровень может добавить функциональность поверх него. Например, Docker монтирует корневую файловую систему как слой только для чтения, а затем добавляет слой чтения-записи поверх него. Все эти слои объединяются с помощью Union Mount для обеспечения операционной среды приложения.

Полная история создания образа WildFly может быть представлена ​​как:

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
docker history --no-trunc=true jboss/wildfly
IMAGE                                                              CREATED             CREATED BY                                                                                                                                                                   SIZE
365390553f925f96f8c00f79525ad101847de7781bb4fec23b1188f25fe99a6a   3 weeks ago         /bin/sh -c #(nop) CMD [/opt/jboss/wildfly/bin/standalone.sh -b 0.0.0.0]                                                                                                      0 B
d7fccab36b8f5a324ef8dd017c8964f2de7839379503021f15502ba3f0b908bd   3 weeks ago         /bin/sh -c #(nop) EXPOSE map[8080/tcp:{} 9990/tcp:{}]                                                                                                                        0 B
184d6d02f340455d33d226d6467484027d0763964a586ae9ada1782262299a74   3 weeks ago         /bin/sh -c #(nop) ENV JBOSS_HOME=/opt/jboss/wildfly                                                                                                                          0 B
57ada25ecdd03191355ec1c8f5f1a4e05b3e152709c9b603d5ed5fb0c4d53853   3 weeks ago         /bin/sh -c cd $HOME && curl http://download.jboss.org/wildfly/$WILDFLY_VERSION/wildfly-$WILDFLY_VERSION.tar.gz | tar zx && mv $HOME/wildfly-$WILDFLY_VERSION $HOME/wildfly   135 MB
59ec65b61fba2b6ada099abe3a9a30d05ffb71370b43dfbd0208fd4f5a34c005   3 weeks ago         /bin/sh -c #(nop) ENV WILDFLY_VERSION=8.1.0.Final                                                                                                                            0 B
90832e1f0bb9e9f98ecd42f6df6b124c1e6768babaddc23d646cd75c7b2fddec   5 weeks ago         /bin/sh -c #(nop) ENV JAVA_HOME=/usr/lib/jvm/java                                                                                                                            0 B
72d585299bb5c5c1c326422cfffadc93d8bb4020f35bf072b2d91d287967807a   5 weeks ago         /bin/sh -c #(nop) USER jboss                                                                                                                                                 0 B
e02bdb6c4ed5436da02c958d302af5f06c1ebb1821791f60d45e190ebb55130f   5 weeks ago         /bin/sh -c yum -y install java-1.7.0-openjdk-devel && yum clean all                                                                                                          217.2 MB
b17a20d6f5f8e7ed0a1dba277acd3f854c531b0476b03d63a8f0df4caf78c763   5 weeks ago         /bin/sh -c #(nop) USER root                                                                                                                                                  0 B
7759146eab1a3aa5ba5ed12483d03e64a6bf1061a383d5713a5e21fc40554457   5 weeks ago         /bin/sh -c #(nop) MAINTAINER Marek Goldmann <mgoldman@redhat.com>                                                                                                            0 B
2ea8562cac7c25a308b4565b66d4f7e11a1d2137a599ef2b32ed23c78f0a0378   5 weeks ago         /bin/sh -c #(nop) USER jboss                                                                                                                                                 0 B
4d37cbbfc67dd508e682a5431a99d8c1feba1bd8352ffd3ea794463d9cfa81cc   5 weeks ago         /bin/sh -c #(nop) WORKDIR /opt/jboss                                                                                                                                         0 B
379edb00ab0764276787ea777243990da697f2f93acb5d9166ff73ad01511a87   5 weeks ago         /bin/sh -c groupadd -r jboss -g 1000 && useradd -u 1000 -r -g jboss -m -d /opt/jboss -s /sbin/nologin -c "JBoss user" jboss                                                  295 kB
cd5bb934bb6755e910d19ac3ae4cfd09221aa2f98c3fbb51a7486991364dc1ae   5 weeks ago         /bin/sh -c yum -y install xmlstarlet saxon augeas bsdtar unzip && yum clean all                                                                                              21.35 MB
20a1abe1d9bfb9b1e46d5411abd5a38b6104a323b7c4fb5c0f1f161b8f7278c2   5 weeks ago         /bin/sh -c yum -y update && yum clean all                                                                                                                                    200.7 MB
1ef0a50fe8b1394d3626a7624a58b58cff9560ddb503743099a56bbe95ab481a   5 weeks ago         /bin/sh -c #(nop) MAINTAINER Marek Goldmann <mgoldman@redhat.com>                                                                                                            0 B
7d3f07f8de5fb3a20c6cb1e4447773a5741e3641c1aa093366eaa0fc690c6417   7 weeks ago         /bin/sh -c #(nop) ADD file:285fdeab65d637727f6b79392a309135494d2e6046c6cc2fbd2f23e43eaac69c in /                                                                             374.1 MB
782cf93a8f16d3016dae352188cd5cfedb6a15c37d4dbd704399f02d1bb89dab   7 weeks ago         /bin/sh -c #(nop) MAINTAINER Lokesh Mandvekar <lsm5@fedoraproject.org> - ./buildcontainers.sh                                                                                0 B
511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158   17 months ago                                                                                                                                                                                    0 B
</lsm5@fedoraproject.org></mgoldman@redhat.com></mgoldman@redhat.com>

Точная команда, выданная на каждом слое, указана в этом выводе Если вы перейдете в крайнее правое положение, то вы также сможете увидеть общее пространство, занимаемое каждым слоем. Например, Fedora используется в качестве базового образа и потребляет ~ 574 МБ всего образа, Open JDK 7 занимает 217,5 МБ, а WildFly — 135 МБ.

Образы Docker создаются путем чтения инструкций из Dockerfile . Это текстовый файл, содержащий все команды в порядке, необходимом для построения заданного изображения. Он придерживается определенного формата и использует определенный набор инструкций. Словарный запас команд довольно ограничен, но хорошо служит цели. Образ можно построить, дав команду docker build . Docker Tutorial содержит подробные инструкции о том, как создать свой собственный образ.

Официальный образ WildFly Docker построен с использованием Fedora 20 в качестве базовой операционной системы. Dockerfile можно увидеть по адресу github.com/jboss-dockerfiles/wildfly/blob/master/Dockerfile . Он использует jboss / base-jdk: 7 в качестве базового образа, который использует jboss / base в качестве базового образа. Dockerfile из jboss / base показывает, что в качестве базового образа используется Fedora 20.

Альтернативой является создание этого образа с использованием CentOS или Ubuntu в качестве базового образа. Dockerfile для этих изображений доступны по адресу github.com/arun-gupta/docker-images/ .

Запуск boot2docker показывает вывод как:

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
bash
unset DYLD_LIBRARY_PATH ; unset LD_LIBRARY_PATH
mkdir -p ~/.boot2docker
if [ ! -f ~/.boot2docker/boot2docker.iso ]; then cp /usr/local/share/boot2docker/boot2docker.iso ~/.boot2docker/ ; fi
/usr/local/bin/boot2docker init
/usr/local/bin/boot2docker up
$(/usr/local/bin/boot2docker shellinit)
docker version
Last login: Mon Nov 24 11:03:33 on ttys006
hello arungupta
~> bash
~> unset DYLD_LIBRARY_PATH ; unset LD_LIBRARY_PATH
~> mkdir -p ~/.boot2docker
~> if [ ! -f ~/.boot2docker/boot2docker.iso ]; then cp /usr/local/share/boot2docker/boot2docker.iso ~/.boot2docker/ ; fi
~> /usr/local/bin/boot2docker init
Virtual machine boot2docker-vm already exists
~> /usr/local/bin/boot2docker up
Waiting for VM and Docker daemon to start...
.....................ooooooooooooooooo
Started.
Writing /Users/arungupta/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/arungupta/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/arungupta/.boot2docker/certs/boot2docker-vm/key.pem
 
To connect the Docker client to the Docker daemon, please set:
    export DOCKER_HOST=tcp://192.168.59.103:2376
    export DOCKER_CERT_PATH=/Users/arungupta/.boot2docker/certs/boot2docker-vm
    export DOCKER_TLS_VERIFY=1
 
~> $(/usr/local/bin/boot2docker shellinit)
Writing /Users/arungupta/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/arungupta/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/arungupta/.boot2docker/certs/boot2docker-vm/key.pem
~> docker version
Client version: 1.3.1
Client API version: 1.15
Go version (client): go1.3.3
Git commit (client): 4e9bbfa
OS/Arch (client): darwin/amd64
Server version: 1.3.1
Server API version: 1.15
Go version (server): go1.3.3
Git commit (server): 4e9bbfa

Затем вы можете создать образ WildFly Docker на базе CentOS, как показано ниже. Обратите внимание, что эта команда дана из каталога «wildfly-centos» на github.com/arun-gupta/docker-images/ . Итак, файл Dockerfile находится по адресу github.com/arun-gupta/docker-images/blob/master/wildfly-centos/Dockerfile .

001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
wildfly-centos> docker build -t wildfly-centos .
Sending build context to Docker daemon 4.096 kB
Sending build context to Docker daemon
Step 0 : FROM centos
centos:latest: The image you are pulling has been verified
511136ea3c5a: Pull complete
5b12ef8fd570: Pull complete
ae0c2d0bdc10: Pull complete
Status: Downloaded newer image for centos:latest
 ---> ae0c2d0bdc10
Step 1 : MAINTAINER Arun Gupta <arungupta@redhat.com>
 ---> Running in 7fc52653d381
 ---> e490dfcb3685
Removing intermediate container 7fc52653d381
Step 2 : RUN yum -y update && yum clean all
 ---> Running in 90de23c9dde7
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: mirror.cc.columbia.edu
 * extras: centos.mirror.ndchost.com
 * updates: centos-distro.cavecreek.net
Resolving Dependencies
--> Running transaction check
---> Package tzdata.noarch 0:2014h-1.el7 will be updated
---> Package tzdata.noarch 0:2014j-1.el7_0 will be an update
--> Finished Dependency Resolution
 
Dependencies Resolved
 
================================================================================
 Package         Arch            Version                 Repository        Size
================================================================================
Updating:
 tzdata          noarch          2014j-1.el7_0           updates          434 k
 
Transaction Summary
================================================================================
Upgrade  1 Package
 
Total download size: 434 k
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
warning: /var/cache/yum/x86_64/7/updates/packages/tzdata-2014j-1.el7_0.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for tzdata-2014j-1.el7_0.noarch.rpm is not installed
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <[email protected]>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 Package    : centos-release-7-0.1406.el7.centos.2.5.x86_64 (@Updates/$releasever)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : tzdata-2014j-1.el7_0.noarch                                  1/2
  Cleanup    : tzdata-2014h-1.el7.noarch                                    2/2
  Verifying  : tzdata-2014j-1.el7_0.noarch                                  1/2
  Verifying  : tzdata-2014h-1.el7.noarch                                    2/2
 
Updated:
  tzdata.noarch 0:2014j-1.el7_0                                                
 
Complete!
Loaded plugins: fastestmirror
Cleaning repos: base extras updates
Cleaning up everything
Cleaning up list of fastest mirrors
 ---> f212cb9dbcf5
Removing intermediate container 90de23c9dde7
Step 3 : RUN yum -y install xmlstarlet saxon augeas bsdtar unzip && yum clean all
 ---> Running in d4bd822933c8
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: mirror-centos.hostingswift.com
 * extras: mirror.keystealth.org
 * updates: mirrors.advancedhosters.com
No package xmlstarlet available.
Resolving Dependencies
--> Running transaction check
---> Package augeas.x86_64 0:1.1.0-12.el7 will be installed
--> Processing Dependency: augeas-libs = 1.1.0-12.el7 for package: augeas-1.1.0-12.el7.x86_64
 
. . .
 
--> Processing Dependency: python-lxml for package: python-javapackages-3.4.1-6.el7_0.noarch
--> Running transaction check
---> Package python-lxml.x86_64 0:3.2.1-4.el7 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
================================================================================
 Package                  Arch        Version                Repository    Size
================================================================================
Installing:
 augeas                   x86_64      1.1.0-12.el7           base          35 k
 bsdtar                   x86_64      3.1.2-7.el7            base          55 k
 
. . .
 
 python-javapackages      noarch      3.4.1-6.el7_0          updates       31 k
 python-lxml              x86_64      3.2.1-4.el7            base         758 k
 
Transaction Summary
================================================================================
Install  4 Packages (+9 Dependent packages)
 
Total download size: 4.2 M
Installed size: 8.0 M
Downloading packages:
--------------------------------------------------------------------------------
Total                                              188 kB/s | 4.2 MB  00:22    
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : lzo-2.06-6.el7_0.2.x86_64                                   1/13
  Installing : libxslt-1.1.28-5.el7.x86_64                                
 
. . .
 
  Installing : unzip-6.0-13.el7.x86_64                                    13/13
  Verifying  : augeas-1.1.0-12.el7.x86_64                                  1/13
 
. . .
 
  Verifying  : javapackages-tools-3.4.1-6.el7_0.noarch                    13/13
 
Installed:
  augeas.x86_64 0:1.1.0-12.el7            bsdtar.x86_64 0:3.1.2-7.el7         
  saxon.noarch 0:9.3.0.4-11.el7           unzip.x86_64 0:6.0-13.el7           
 
Dependency Installed:
  augeas-libs.x86_64 0:1.1.0-12.el7  bea-stax.noarch 0:1.2.0-9.el7             
  bea-stax-api.noarch 0:1.2.0-9.el7  javapackages-tools.noarch 0:3.4.1-6.el7_0 
  libarchive.x86_64 0:3.1.2-7.el7    libxslt.x86_64 0:1.1.28-5.el7             
  lzo.x86_64 0:2.06-6.el7_0.2        python-javapackages.noarch 0:3.4.1-6.el7_0
  python-lxml.x86_64 0:3.2.1-4.el7 
 
Complete!
Loaded plugins: fastestmirror
Cleaning repos: base extras updates
Cleaning up everything
Cleaning up list of fastest mirrors
 ---> 28b11e6151f0
Removing intermediate container d4bd822933c8
Step 4 : RUN groupadd -r jboss -g 1000 && useradd -u 1000 -r -g jboss -m -d /opt/jboss -s /sbin/nologin -c "JBoss user" jboss
 ---> Running in 943c20ba5a51
 ---> 73603eab89b7
Removing intermediate container 943c20ba5a51
Step 5 : WORKDIR /opt/jboss
 ---> Running in 29c865c3109c
 ---> 9a661ae4341b
Removing intermediate container 29c865c3109c
Step 6 : USER jboss
 ---> Running in 7dfd8416ae2c
 ---> 6265153611c7
Removing intermediate container 7dfd8416ae2c
Step 7 : USER root
 ---> Running in a72588fba840
 ---> 12ed28a7acb7
Removing intermediate container a72588fba840
Step 8 : RUN yum -y install java-1.7.0-openjdk-devel && yum clean all
 ---> Running in 4efb3e17eb38
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: mirror.trouble-free.net
 * extras: centos.mirror.ndchost.com
 * updates: centos-distro.cavecreek.net
Resolving Dependencies
--> Running transaction check
---> Package java-1.7.0-openjdk-devel.x86_64 1:1.7.0.71-2.5.3.1.el7_0 will be installed
 
. . .
 
---> Package hwdata.noarch 0:0.252-7.3.el7 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
================================================================================
 Package                      Arch    Version                    Repository
                                                                           Size
================================================================================
Installing:
 java-1.7.0-openjdk-devel     x86_64  1:1.7.0.71-2.5.3.1.el7_0   updates  9.2 M
Installing for dependencies:
 alsa-lib                     x86_64  1.0.27.2-3.el7             base     389 k
 
. . .
 
144 k
 xorg-x11-font-utils          x86_64  1:7.5-18.1.el7             base      87 k
 xorg-x11-fonts-Type1         noarch  7.5-9.el7                  base     521 k
 
Transaction Summary
================================================================================
Install  1 Package (+73 Dependent packages)
 
Total download size: 49 M
Installed size: 181 M
Downloading packages:
--------------------------------------------------------------------------------
Total                                              1.7 MB/s |  49 MB  00:29    
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : freetype-2.4.11-9.el7.x86_64                                1/74
  Installing : libjpeg-turbo-1.2.90-5.el7.x86_64                           2/74
 
. . .
 
73/74
  Installing : 1:java-1.7.0-openjdk-devel-1.7.0.71-2.5.3.1.el7_0.x86_64   74/74
  Verifying  : libsndfile-1.0.25-9.el7.x86_64                              1/74
  Verifying  : libXfont-1.4.7-2.el7_0.x86_64                               2/74
  Verifying  : kmod-14-9.el7.x86_64                                       
 
. . .
 
73/74
  Verifying  : gdk-pixbuf2-2.28.2-4.el7.x86_64                            74/74
 
Installed:
  java-1.7.0-openjdk-devel.x86_64 1:1.7.0.71-2.5.3.1.el7_0                     
 
Dependency Installed:
  alsa-lib.x86_64 0:1.0.27.2-3.el7                                             
  atk.x86_64 0:2.8.0-4.el7                                                     
 
. . .
                                           
  xorg-x11-font-utils.x86_64 1:7.5-18.1.el7                                    
  xorg-x11-fonts-Type1.noarch 0:7.5-9.el7                                      
 
Complete!
Loaded plugins: fastestmirror
Cleaning repos: base extras updates
Cleaning up everything
Cleaning up list of fastest mirrors
 ---> 44c4bb92fa11
Removing intermediate container 4efb3e17eb38
Step 9 : USER jboss
 ---> Running in 824d62c49182
 ---> 930cb2a860f7
Removing intermediate container 824d62c49182
Step 10 : ENV JAVA_HOME /usr/lib/jvm/java
 ---> Running in f19681365fe5
 ---> fff2c21b0a71
Removing intermediate container f19681365fe5
Step 11 : ENV WILDFLY_VERSION 8.2.0.Final
 ---> Running in cc9d42ece5c1
 ---> b7b7ca7a9172
Removing intermediate container cc9d42ece5c1
Step 12 : RUN cd $HOME && curl -O http://download.jboss.org/wildfly/$WILDFLY_VERSION/wildfly-$WILDFLY_VERSION.zip && unzip wildfly-$WILDFLY_VERSION.zip && mv $HOME/wildfly-$WILDFLY_VERSION $HOME/wildfly && rm wildfly-$WILDFLY_VERSION.zip
 ---> Running in 28e92a1b304f
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  126M  100  126M    0     0   813k      0  0:02:38  0:02:38 --:--:--  644k
Archive:  wildfly-8.2.0.Final.zip
   creating: wildfly-8.2.0.Final/
   creating: wildfly-8.2.0.Final/.installation/
   creating: wildfly-8.2.0.Final/appclient/
   creating: wildfly-8.2.0.Final/appclient/configuration/
   creating: wildfly-8.2.0.Final/bin/
 
. . .
 
  inflating: wildfly-8.2.0.Final/domain/configuration/application-users.properties 
  inflating: wildfly-8.2.0.Final/domain/configuration/mgmt-users.properties 
  inflating: wildfly-8.2.0.Final/standalone/configuration/application-users.properties 
  inflating: wildfly-8.2.0.Final/standalone/configuration/mgmt-users.properties 
   creating: wildfly-8.2.0.Final/domain/tmp/auth/
   creating: wildfly-8.2.0.Final/standalone/tmp/auth/
 ---> a1bc79a43c77
Removing intermediate container 28e92a1b304f
Step 13 : ENV JBOSS_HOME /opt/jboss/wildfly
 ---> Running in e3c995170046
 ---> d46fdd618d55
Removing intermediate container e3c995170046
Step 14 : EXPOSE 8080 9990
 ---> Running in d55d6a6f43cf
 ---> 6c17e2cefecf
Removing intermediate container d55d6a6f43cf
Step 15 : CMD /opt/jboss/wildfly/bin/standalone.sh -b 0.0.0.0
 ---> Running in 76e2630d16f5
 ---> 97c8780a7d6a
Removing intermediate container 76e2630d16f5
Successfully built 97c8780a7d6a

Список изображений Docker теперь можно увидеть как:

1
2
3
4
wildfly-centos> docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
wildfly-centos      latest              97c8780a7d6a        58 seconds ago      619.6 MB
centos              latest              ae0c2d0bdc10        2 weeks ago         224 MB

Общий размер изображения составляет 619,6 МБ. Официальный образ WildFly Docker может быть установлен, как показано:

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
wildfly-centos> docker pull jboss/wildfly
Pulling repository jboss/wildfly
365390553f92: Download complete
511136ea3c5a: Download complete
782cf93a8f16: Download complete
7d3f07f8de5f: Download complete
1ef0a50fe8b1: Download complete
20a1abe1d9bf: Download complete
cd5bb934bb67: Download complete
379edb00ab07: Download complete
4d37cbbfc67d: Download complete
2ea8562cac7c: Download complete
7759146eab1a: Download complete
b17a20d6f5f8: Download complete
e02bdb6c4ed5: Download complete
72d585299bb5: Download complete
90832e1f0bb9: Download complete
59ec65b61fba: Download complete
57ada25ecdd0: Download complete
184d6d02f340: Download complete
d7fccab36b8f: Download complete
Status: Downloaded newer image for jboss/wildfly:latest

И полный список образов Docker снова можно увидеть как:

1
2
3
4
5
wildfly-centos> docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
wildfly-centos      latest              97c8780a7d6a        12 minutes ago      619.6 MB
centos              latest              ae0c2d0bdc10        2 weeks ago         224 MB
jboss/wildfly       latest              365390553f92        4 weeks ago         948.7 MB

Размер изображения в этом случае составляет 948,7 МБ. Детальное понимание этого изображения было объяснено ранее в этом блоге.

Образ WildFly на основе Ubuntu может быть собран и установлен, как показано ниже. Обратите внимание, что эта команда дана из каталога «wildfly-ubuntu» на github.com/arun-gupta/docker-images/ . Итак, файл Dockerfile находится по адресу github.com/arun-gupta/docker-images/blob/master/wildfly-ubuntu/Dockerfile .

001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
wildfly-ubuntu> docker build -t wildfly-ubuntu .
Sending build context to Docker daemon 4.096 kB
Sending build context to Docker daemon
Step 0 : FROM ubuntu
ubuntu:latest: The image you are pulling has been verified
d497ad3926c8: Pull complete
ccb62158e970: Pull complete
e791be0477f2: Pull complete
3680052c0f5c: Pull complete
22093c35d77b: Pull complete
5506de2b643b: Pull complete
511136ea3c5a: Already exists
Status: Downloaded newer image for ubuntu:latest
 ---> 5506de2b643b
Step 1 : MAINTAINER Arun Gupta <arungupta@redhat.com>
 ---> Running in cc444b436b26
 ---> 9df66d33d676
Removing intermediate container cc444b436b26
Step 2 : RUN apt-get update
 ---> Running in 3dc63c0f708a
Ign http://archive.ubuntu.com trusty InRelease
Ign http://archive.ubuntu.com trusty-updates InRelease
Ign http://archive.ubuntu.com trusty-security InRelease
Ign http://archive.ubuntu.com trusty-proposed InRelease
Get:1 http://archive.ubuntu.com trusty Release.gpg [933 B]
Get:2 http://archive.ubuntu.com trusty-updates Release.gpg [933 B]
Get:3 http://archive.ubuntu.com trusty-security Release.gpg [933 B]
Get:4 http://archive.ubuntu.com trusty-proposed Release.gpg [933 B]
Get:5 http://archive.ubuntu.com trusty Release [58.5 kB]
Get:6 http://archive.ubuntu.com trusty-updates Release [62.0 kB]
Get:7 http://archive.ubuntu.com trusty-security Release [62.0 kB]
Get:8 http://archive.ubuntu.com trusty-proposed Release [209 kB]
Get:9 http://archive.ubuntu.com trusty/main Sources [1335 kB]
Get:10 http://archive.ubuntu.com trusty/restricted Sources [5335 B]
Get:11 http://archive.ubuntu.com trusty/universe Sources [7926 kB]
Get:12 http://archive.ubuntu.com trusty/main amd64 Packages [1743 kB]
Get:13 http://archive.ubuntu.com trusty/restricted amd64 Packages [16.0 kB]
Get:14 http://archive.ubuntu.com trusty/universe amd64 Packages [7589 kB]
Get:15 http://archive.ubuntu.com trusty-updates/main Sources [179 kB]
Get:16 http://archive.ubuntu.com trusty-updates/restricted Sources [1250 B]
Get:17 http://archive.ubuntu.com trusty-updates/universe Sources [114 kB]
Get:18 http://archive.ubuntu.com trusty-updates/main amd64 Packages [465 kB]
Get:19 http://archive.ubuntu.com trusty-updates/restricted amd64 Packages [6341 B]
Get:20 http://archive.ubuntu.com trusty-updates/universe amd64 Packages [286 kB]
Get:21 http://archive.ubuntu.com trusty-security/main Sources [62.7 kB]
Get:22 http://archive.ubuntu.com trusty-security/restricted Sources [40 B]
Get:23 http://archive.ubuntu.com trusty-security/universe Sources [19.1 kB]
Get:24 http://archive.ubuntu.com trusty-security/main amd64 Packages [205 kB]
Get:25 http://archive.ubuntu.com trusty-security/restricted amd64 Packages [40 B]
Get:26 http://archive.ubuntu.com trusty-security/universe amd64 Packages [93.4 kB]
Get:27 http://archive.ubuntu.com trusty-proposed/main amd64 Packages [193 kB]
Get:28 http://archive.ubuntu.com trusty-proposed/restricted amd64 Packages [40 B]
Fetched 20.6 MB in 43s (469 kB/s)
Reading package lists...
 ---> 7fcaaf17b124
Removing intermediate container 3dc63c0f708a
Step 3 : RUN apt-get -y install xmlstarlet bsdtar unzip curl
 ---> Running in 81613b0e3b71
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
  ca-certificates krb5-locales libarchive13 libasn1-8-heimdal libcurl3
  libgssapi-krb5-2 libgssapi3-heimdal libhcrypto4-heimdal libheimbase1-heimdal
 
. . .
 
Updating certificates in /etc/ssl/certs... 164 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d....done.
Processing triggers for sgml-base (1.26+nmu4ubuntu1) ...
 ---> 0d897d545547
Removing intermediate container 81613b0e3b71
Step 4 : RUN groupadd -r jboss -g 1000 && useradd -u 1000 -r -g jboss -m -d /opt/jboss -s /sbin/nologin -c "JBoss user" jboss
 ---> Running in bf31e0e1f448
 ---> 7494e71043c0
Removing intermediate container bf31e0e1f448
Step 5 : WORKDIR /opt/jboss
 ---> Running in 1ac355c74395
 ---> abbbb6aa6b71
Removing intermediate container 1ac355c74395
Step 6 : USER jboss
 ---> Running in a656007f6e6b
 ---> 657671b82d0f
Removing intermediate container a656007f6e6b
Step 7 : USER root
 ---> Running in f53138927d04
 ---> d3bd53152a51
Removing intermediate container f53138927d04
Step 8 : RUN apt-get -y install openjdk-7-jdk
 ---> Running in 1076b257c6f6
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
  acl at-spi2-core ca-certificates ca-certificates-java colord cpp cpp-4.8
  dbus dbus-x11 dconf-gsettings-backend dconf-service desktop-file-utils
 
. . .
 
Adding debian:Wells_Fargo_Root_CA.pem
Adding debian:XRamp_Global_CA_Root.pem
Adding debian:certSIGN_ROOT_CA.pem
Adding debian:ePKI_Root_Certification_Authority.pem
Adding debian:thawte_Primary_Root_CA.pem
Adding debian:thawte_Primary_Root_CA_-_G2.pem
Adding debian:thawte_Primary_Root_CA_-_G3.pem
Adding debian:spi-cacert-2008.pem
done.
done.
 ---> 558f23c93a8c
Removing intermediate container 1076b257c6f6
Step 9 : USER jboss
 ---> Running in 9d6955bcd19f
 ---> 7f16c426ccaf
Removing intermediate container 9d6955bcd19f
Step 10 : ENV JAVA_HOME /usr/lib/jvm/java-7-openjdk-amd64
 ---> Running in 66f22bd0de95
 ---> 6304f386c946
Removing intermediate container 66f22bd0de95
Step 11 : ENV WILDFLY_VERSION 8.2.0.Final
 ---> Running in 784e1533fa09
 ---> 1a5e1aeadc85
Removing intermediate container 784e1533fa09
Step 12 : RUN cd $HOME && curl -O http://download.jboss.org/wildfly/$WILDFLY_VERSION/wildfly-$WILDFLY_VERSION.zip && unzip wildfly-$WILDFLY_VERSION.zip && mv $HOME/wildfly-$WILDFLY_VERSION $HOME/wildfly && rm wildfly-$WILDFLY_VERSION.zip
 ---> Running in c7d808526af6
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  126M  100  126M    0     0   993k      0  0:02:09  0:02:09 --:--:--  870k
Archive:  wildfly-8.2.0.Final.zip
   creating: wildfly-8.2.0.Final/
 
. . .
 
  inflating: wildfly-8.2.0.Final/standalone/configuration/mgmt-users.properties 
   creating: wildfly-8.2.0.Final/domain/tmp/auth/
   creating: wildfly-8.2.0.Final/standalone/tmp/auth/
 ---> 551e8b1db275
Removing intermediate container c7d808526af6
Step 13 : ENV JBOSS_HOME /opt/jboss/wildfly
 ---> Running in 7709c6f468ef
 ---> 0cec4b9ccd6b
Removing intermediate container 7709c6f468ef
Step 14 : EXPOSE 8080 9990
 ---> Running in dd053271b09e
 ---> 0281986b0ed8
Removing intermediate container dd053271b09e
Step 15 : CMD /opt/jboss/wildfly/bin/standalone.sh -b 0.0.0.0
 ---> Running in fb29091de599
 ---> 6a1c4acf3f78
Removing intermediate container fb29091de599
Successfully built 6a1c4acf3f78
</arungupta@redhat.com>

Список образов Docker снова можно увидеть как:

1
2
3
4
5
6
7
8
wildfly-ubuntu> docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
wildfly-ubuntu      latest              6a1c4acf3f78        5 minutes ago       749.5 MB
<none>              <none>              1a5e1aeadc85        13 minutes ago      607.7 MB
wildfly-centos      latest              97c8780a7d6a        About an hour ago   619.6 MB
centos              latest              ae0c2d0bdc10        2 weeks ago         224 MB
jboss/wildfly       latest              365390553f92        4 weeks ago         948.7 MB
ubuntu              latest              5506de2b643b        4 weeks ago         199.3 MB

Образ Docker можно запустить с помощью команды Docker docker run . Некоторые другие связанные команды:

  • docker ps : списки контейнеров
  • docker stop <id> : останавливает контейнер с указанным <id>

Запустите изображение CentOS, как показано ниже. Указание опции -i сделает ее интерактивной, а опция -t выделяет псевдо-TTY. И порт 8080 из контейнера сделан доступным через порт 80 контейнера.

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
~> docker run -i -t -p 80:8080 wildfly-centos
=========================================================================
 
  JBoss Bootstrap Environment
 
  JBOSS_HOME: /opt/jboss/wildfly
 
  JAVA: /usr/lib/jvm/java/bin/java
 
  JAVA_OPTS:  -server -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true
 
=========================================================================
 
22:20:52,769 INFO  [org.jboss.modules] (main) JBoss Modules version 1.3.3.Final
22:20:53,038 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.2.Final
22:20:53,120 INFO  [org.jboss.as] (MSC service thread 1-7) JBAS015899: WildFly 8.2.0.Final "Tweek" starting
22:20:54,176 INFO  [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)
22:20:54,197 INFO  [org.xnio] (MSC service thread 1-10) XNIO version 3.3.0.Final
22:20:54,206 INFO  [org.xnio.nio] (MSC service thread 1-10) XNIO NIO Implementation Version 3.3.0.Final
22:20:54,239 INFO  [org.wildfly.extension.io] (ServerService Thread Pool -- 31) WFLYIO001: Worker 'default' has auto-configured to 16 core threads with 128 task threads based on your 8 available processors
22:20:54,265 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 32) JBAS010280: Activating Infinispan subsystem.
22:20:54,302 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 45) JBAS013171: Activating Security Subsystem
22:20:54,314 WARN  [org.jboss.as.txn] (ServerService Thread Pool -- 46) JBAS010153: Node identifier property is set to the default value. Please make sure it is unique.
22:20:54,345 INFO  [org.jboss.as.jsf] (ServerService Thread Pool -- 38) JBAS012615: Activated the following JSF Implementations: [main]
22:20:54,363 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 40) JBAS011800: Activating Naming Subsystem
22:20:54,374 INFO  [org.jboss.as.security] (MSC service thread 1-8) JBAS013170: Current PicketBox version=4.0.21.Final
22:20:54,419 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
22:20:54,486 INFO  [org.jboss.as.connector.logging] (MSC service thread 1-7) JBAS010408: Starting JCA Subsystem (IronJacamar 1.1.9.Final)
22:20:54,573 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-7) JBAS017502: Undertow 1.1.0.Final starting
22:20:54,579 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017502: Undertow 1.1.0.Final starting
22:20:54,586 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
22:20:54,644 INFO  [org.jboss.remoting] (MSC service thread 1-10) JBoss Remoting version 4.0.6.Final
22:20:54,658 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-1) JBAS010417: Started Driver service with driver-name = h2
22:20:54,763 INFO  [org.jboss.as.naming] (MSC service thread 1-1) JBAS011802: Starting Naming Service
22:20:54,761 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-16) JBAS015400: Bound mail session
22:20:56,387 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017527: Creating file handler for path /opt/jboss/wildfly/welcome-content
22:20:56,422 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-10) JBAS017525: Started server default-server.
22:20:56,544 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) JBAS017531: Host default-host starting
22:20:56,712 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-10) JBAS017519: Undertow HTTP listener default listening on /0.0.0.0:8080
22:20:56,975 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-14) JBAS010400: Bound data source
22:20:56,976 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-15) JBAS015012: Started FileSystemDeploymentService for directory /opt/jboss/wildfly/standalone/deployments
22:20:57,172 INFO  [org.jboss.ws.common.management] (MSC service thread 1-10) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.3.2.Final
22:20:57,239 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
22:20:57,240 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
22:20:57,241 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: WildFly 8.2.0.Final "Tweek" started in 4836ms - Started 184 of 234 services (82 services are lazy, passive or on-demand)

В другой оболочке получите IP-адрес контейнера как:

1
2
3
~> boot2docker ip
 
The VM's Host only interface IP address is: 192.168.59.103

А затем получите доступ к WildFly по адресу http://192.168.59.103 .

Аналогично, при запуске образа WildFly Ubuntu:

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
wildfly-ubuntu> docker run -i -t -p 80:8080 wildfly-ubuntu
=========================================================================
 
  JBoss Bootstrap Environment
 
  JBOSS_HOME: /opt/jboss/wildfly
 
  JAVA: /usr/lib/jvm/java-7-openjdk-amd64/bin/java
 
  JAVA_OPTS:  -server -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true
 
=========================================================================
 
22:34:07,612 INFO  [org.jboss.modules] (main) JBoss Modules version 1.3.3.Final
22:34:07,911 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.2.Final
22:34:07,996 INFO  [org.jboss.as] (MSC service thread 1-7) JBAS015899: WildFly 8.2.0.Final "Tweek" starting
22:34:09,076 INFO  [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)
22:34:09,097 INFO  [org.xnio] (MSC service thread 1-9) XNIO version 3.3.0.Final
22:34:09,106 INFO  [org.xnio.nio] (MSC service thread 1-9) XNIO NIO Implementation Version 3.3.0.Final
22:34:09,136 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 32) JBAS010280: Activating Infinispan subsystem.
22:34:09,170 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 45) JBAS013171: Activating Security Subsystem
22:34:09,180 WARN  [org.jboss.as.txn] (ServerService Thread Pool -- 46) JBAS010153: Node identifier property is set to the default value. Please make sure it is unique.
22:34:09,191 INFO  [org.jboss.as.jsf] (ServerService Thread Pool -- 38) JBAS012615: Activated the following JSF Implementations: [main]
22:34:09,207 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 40) JBAS011800: Activating Naming Subsystem
22:34:09,212 INFO  [org.jboss.as.security] (MSC service thread 1-2) JBAS013170: Current PicketBox version=4.0.21.Final
22:34:09,230 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
22:34:09,317 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-6) JBAS017502: Undertow 1.1.0.Final starting
22:34:09,317 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017502: Undertow 1.1.0.Final starting
22:34:09,323 INFO  [org.wildfly.extension.io] (ServerService Thread Pool -- 31) WFLYIO001: Worker 'default' has auto-configured to 16 core threads with 128 task threads based on your 8 available processors
22:34:09,413 INFO  [org.jboss.as.connector.logging] (MSC service thread 1-15) JBAS010408: Starting JCA Subsystem (IronJacamar 1.1.9.Final)
22:34:09,617 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
22:34:09,658 INFO  [org.jboss.as.naming] (MSC service thread 1-10) JBAS011802: Starting Naming Service
22:34:09,674 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-1) JBAS015400: Bound mail session
22:34:09,692 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-12) JBAS010417: Started Driver service with driver-name = h2
22:34:09,693 INFO  [org.jboss.remoting] (MSC service thread 1-9) JBoss Remoting version 4.0.6.Final
22:34:11,117 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017527: Creating file handler for path /opt/jboss/wildfly/welcome-content
22:34:11,134 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-5) JBAS017525: Started server default-server.
22:34:11,206 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-14) JBAS017531: Host default-host starting
22:34:11,377 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-5) JBAS017519: Undertow HTTP listener default listening on /0.0.0.0:8080
22:34:11,576 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-2) JBAS015012: Started FileSystemDeploymentService for directory /opt/jboss/wildfly/standalone/deployments
22:34:11,627 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-8) JBAS010400: Bound data source
22:34:11,847 INFO  [org.jboss.ws.common.management] (MSC service thread 1-6) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.3.2.Final
22:34:11,911 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
22:34:11,912 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
22:34:11,912 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: WildFly 8.2.0.Final "Tweek" started in 4762ms - Started 184 of 234 services (82 services are lazy, passive or on-demand)

Вы можете войти на хост-машину, как показано на рисунке:

1
boot2docker ssh

Различные слои изображения хранятся в каталоге /var/lib/docker как показано ниже:

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
docker-images> boot2docker ssh
                        ##        .
                  ## ## ##       ==
               ## ## ## ##      ===
           /""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~
           \______ o          __/
             \    \        __/
              \____\______/
 _                 _   ____     _            _
| |__   ___   ___ | |_|___ \ __| | ___   ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__|   <  __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
Boot2Docker version 1.3.2, build master : 495c19a - Mon Nov 24 20:40:58 UTC 2014
Docker version 1.3.2, build 39fa2fa
docker@boot2docker:~$ cd /var/lib/docker/
docker@boot2docker:/mnt/sda1/var/lib/docker$ ls -la
total 64
drwxr-xr-x   10 root     root          4096 Nov 24 23:33 ./
drwxr-xr-x    4 root     root          4096 Nov 24 19:15 ../
drwxr-xr-x    5 root     root          4096 Nov 24 19:16 aufs/
drwx------   17 root     root          4096 Nov 24 23:33 containers/
drwx------    3 root     root          4096 Nov 24 19:16 execdriver/
drwx------   84 root     root         12288 Nov 24 23:28 graph/
drwx------    2 root     root          4096 Nov 25 14:50 init/
-rw-r--r--    1 root     root         11264 Nov 24 23:33 linkgraph.db
-rw-------    1 root     root           565 Nov 24 23:28 repositories-aufs
drwx------    2 root     root          4096 Nov 24 23:28 tmp/
drwx------    2 root     root          4096 Nov 24 19:21 trust/
drwx------    2 root     root          4096 Nov 24 19:16 volumes/

Образ виртуальной машины на Mac OSX хранится в ~/VirtualBox VMs/boot2docker-vm . Этот каталог может расти довольно быстро, если промежуточные контейнеры не будут удалены. boot2docker-vm.vmdk на моей машине составляет ~ 5 ГБ для этих разных образов.

Вы можете сбросить его, выполнив следующие команды (ВНИМАНИЕ: Это уничтожит все изображения, которые вы загрузили и создали до сих пор):

1
2
3
4
boot2docker down
boot2docker destroy
boot2docker init
boot2docker up

Контейнеры, как вы можете себе представить, имеют отпечаток памяти.

Больше доброты Docker придет в последующих блогах!

Ссылка: Создайте свой собственный образ Docker от нашего партнера JCG Аруна Гупта в блоге Miles to go 2.0… .