Amazon Linux 2で簡単なDockerイメージを作ってみた。
・https://docs.aws.amazon.com/ja_jp/AmazonECS/latest/developerguide/docker-basics.html
Dockerファイルの作成
Dockerfileを作ります。
1 |
$ vim Dockerfile |
中身は以下の通り。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
FROM ubuntu:18.04 # Install dependencies RUN apt-get update && \ apt-get -y install apache2 # Install apache and write hello world message RUN echo 'Hello World!' > /var/www/html/index.html # Configure apache RUN echo '. /etc/apache2/envvars' > /root/run_apache.sh && \ echo 'mkdir -p /var/run/apache2' >> /root/run_apache.sh && \ echo 'mkdir -p /var/lock/apache2' >> /root/run_apache.sh && \ echo '/usr/sbin/apache2 -D FOREGROUND' >> /root/run_apache.sh && \ chmod 755 /root/run_apache.sh EXPOSE 80 CMD /root/run_apache.sh |
Dockerfile から Docker イメージを作成
Dockerfileからイメージを作るには、docker build コマンドを使います。
1 2 3 4 5 6 7 8 9 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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 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 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 |
$ docker build -t hello-world . Sending build context to Docker daemon 2.56kB Step 1/6 : FROM ubuntu:18.04 18.04: Pulling from library/ubuntu 23884877105a: Pull complete bc38caa0f5b9: Pull complete 2910811b6c42: Pull complete 36505266dcc6: Pull complete Digest: sha256:3235326357dfb65f1781dbc4df3b834546d8bf914e82cce58e6e6b676e23ce8f Status: Downloaded newer image for ubuntu:18.04 ---> c3c304cb4f22 Step 2/6 : RUN apt-get update && apt-get -y install apache2 ---> Running in a168d34f63ec Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB] Get:2 http://archive.ubuntu.com/ubuntu bionic InRelease [242 kB] Get:3 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [854 kB] Get:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB] Get:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB] Get:6 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [11.3 MB] Get:7 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [8815 B] Get:8 http://security.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages [59.3 kB] Get:9 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [931 kB] Get:10 http://archive.ubuntu.com/ubuntu bionic/restricted amd64 Packages [13.5 kB] Get:11 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages [186 kB] Get:12 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages [1344 kB] Get:13 http://archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [73.6 kB] Get:14 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1385 kB] Get:15 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [1228 kB] Get:16 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [20.1 kB] Get:17 http://archive.ubuntu.com/ubuntu bionic-backports/main amd64 Packages [8286 B] Get:18 http://archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages [8158 B] Fetched 18.0 MB in 1min 8s (262 kB/s) Reading package lists... Reading package lists... Building dependency tree... Reading state information... The following additional packages will be installed: apache2-bin apache2-data apache2-utils file libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libasn1-8-heimdal libexpat1 libgdbm-compat4 libgdbm5 libgssapi3-heimdal libhcrypto4-heimdal libheimbase1-heimdal libheimntlm0-heimdal libhx509-5-heimdal libicu60 libkrb5-26-heimdal libldap-2.4-2 libldap-common liblua5.2-0 libmagic-mgc libmagic1 libnghttp2-14 libperl5.26 libroken18-heimdal libsasl2-2 libsasl2-modules libsasl2-modules-db libsqlite3-0 libssl1.1 libwind0-heimdal libxml2 mime-support netbase openssl perl perl-modules-5.26 ssl-cert xz-utils Suggested packages: www-browser apache2-doc apache2-suexec-pristine | apache2-suexec-custom ufw gdbm-l10n libsasl2-modules-gssapi-mit | libsasl2-modules-gssapi-heimdal libsasl2-modules-ldap libsasl2-modules-otp libsasl2-modules-sql ca-certificates perl-doc libterm-readline-gnu-perl | libterm-readline-perl-perl make openssl-blacklist The following NEW packages will be installed: apache2 apache2-bin apache2-data apache2-utils file libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libasn1-8-heimdal libexpat1 libgdbm-compat4 libgdbm5 libgssapi3-heimdal libhcrypto4-heimdal libheimbase1-heimdal libheimntlm0-heimdal libhx509-5-heimdal libicu60 libkrb5-26-heimdal libldap-2.4-2 libldap-common liblua5.2-0 libmagic-mgc libmagic1 libnghttp2-14 libperl5.26 libroken18-heimdal libsasl2-2 libsasl2-modules libsasl2-modules-db libsqlite3-0 libssl1.1 libwind0-heimdal libxml2 mime-support netbase openssl perl perl-modules-5.26 ssl-cert xz-utils 0 upgraded, 42 newly installed, 0 to remove and 4 not upgraded. Need to get 21.0 MB of archives. After this operation, 99.4 MB of additional disk space will be used. Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 perl-modules-5.26 all 5.26.1-6ubuntu0.3 [2763 kB] Get:2 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgdbm5 amd64 1.14.1-6 [26.0 kB] Get:3 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgdbm-compat4 amd64 1.14.1-6 [6084 B] Get:4 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libperl5.26 amd64 5.26.1-6ubuntu0.3 [3527 kB] Get:5 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 perl amd64 5.26.1-6ubuntu0.3 [201 kB] Get:6 http://archive.ubuntu.com/ubuntu bionic/main amd64 mime-support all 3.60ubuntu1 [30.1 kB] Get:7 http://archive.ubuntu.com/ubuntu bionic/main amd64 libapr1 amd64 1.6.3-2 [90.9 kB] Get:8 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libexpat1 amd64 2.2.5-3ubuntu0.2 [80.5 kB] Get:9 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libssl1.1 amd64 1.1.1-1ubuntu2.1~18.04.6 [1301 kB] Get:10 http://archive.ubuntu.com/ubuntu bionic/main amd64 libaprutil1 amd64 1.6.1-2 [84.4 kB] Get:11 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libsqlite3-0 amd64 3.22.0-1ubuntu0.3 [498 kB] Get:12 http://archive.ubuntu.com/ubuntu bionic/main amd64 libaprutil1-dbd-sqlite3 amd64 1.6.1-2 [10.6 kB] Get:13 http://archive.ubuntu.com/ubuntu bionic/main amd64 libroken18-heimdal amd64 7.5.0+dfsg-1 [41.3 kB] Get:14 http://archive.ubuntu.com/ubuntu bionic/main amd64 libasn1-8-heimdal amd64 7.5.0+dfsg-1 [175 kB] Get:15 http://archive.ubuntu.com/ubuntu bionic/main amd64 libheimbase1-heimdal amd64 7.5.0+dfsg-1 [29.3 kB] Get:16 http://archive.ubuntu.com/ubuntu bionic/main amd64 libhcrypto4-heimdal amd64 7.5.0+dfsg-1 [85.9 kB] Get:17 http://archive.ubuntu.com/ubuntu bionic/main amd64 libwind0-heimdal amd64 7.5.0+dfsg-1 [47.8 kB] Get:18 http://archive.ubuntu.com/ubuntu bionic/main amd64 libhx509-5-heimdal amd64 7.5.0+dfsg-1 [107 kB] Get:19 http://archive.ubuntu.com/ubuntu bionic/main amd64 libkrb5-26-heimdal amd64 7.5.0+dfsg-1 [206 kB] Get:20 http://archive.ubuntu.com/ubuntu bionic/main amd64 libheimntlm0-heimdal amd64 7.5.0+dfsg-1 [14.8 kB] Get:21 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgssapi3-heimdal amd64 7.5.0+dfsg-1 [96.5 kB] Get:22 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libsasl2-modules-db amd64 2.1.27~101-g0780600+dfsg-3ubuntu2.1 [14.8 kB] Get:23 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libsasl2-2 amd64 2.1.27~101-g0780600+dfsg-3ubuntu2.1 [49.2 kB] Get:24 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libldap-common all 2.4.45+dfsg-1ubuntu1.5 [16.9 kB] Get:25 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libldap-2.4-2 amd64 2.4.45+dfsg-1ubuntu1.5 [155 kB] Get:26 http://archive.ubuntu.com/ubuntu bionic/main amd64 libaprutil1-ldap amd64 1.6.1-2 [8764 B] Get:27 http://archive.ubuntu.com/ubuntu bionic/main amd64 liblua5.2-0 amd64 5.2.4-1.1build1 [108 kB] Get:28 http://archive.ubuntu.com/ubuntu bionic/main amd64 libnghttp2-14 amd64 1.30.0-1ubuntu1 [77.8 kB] Get:29 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libicu60 amd64 60.2-3ubuntu3.1 [8054 kB] Get:30 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libxml2 amd64 2.9.4+dfsg1-6.1ubuntu1.3 [663 kB] Get:31 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 apache2-bin amd64 2.4.29-1ubuntu4.13 [1070 kB] Get:32 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 apache2-utils amd64 2.4.29-1ubuntu4.13 [83.8 kB] Get:33 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 apache2-data all 2.4.29-1ubuntu4.13 [160 kB] Get:34 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 apache2 amd64 2.4.29-1ubuntu4.13 [95.1 kB] Get:35 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libmagic-mgc amd64 1:5.32-2ubuntu0.4 [184 kB] Get:36 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libmagic1 amd64 1:5.32-2ubuntu0.4 [68.6 kB] Get:37 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 file amd64 1:5.32-2ubuntu0.4 [22.1 kB] Get:38 http://archive.ubuntu.com/ubuntu bionic/main amd64 netbase all 5.4 [12.7 kB] Get:39 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 openssl amd64 1.1.1-1ubuntu2.1~18.04.6 [614 kB] Get:40 http://archive.ubuntu.com/ubuntu bionic/main amd64 xz-utils amd64 5.2.2-1.3 [83.8 kB] Get:41 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libsasl2-modules amd64 2.1.27~101-g0780600+dfsg-3ubuntu2.1 [48.8 kB] Get:42 http://archive.ubuntu.com/ubuntu bionic/main amd64 ssl-cert all 1.0.39 [17.0 kB] debconf: delaying package configuration, since apt-utils is not installed Fetched 21.0 MB in 1min 28s (238 kB/s) Selecting previously unselected package perl-modules-5.26. (Reading database ... 4046 files and directories currently installed.) Preparing to unpack .../00-perl-modules-5.26_5.26.1-6ubuntu0.3_all.deb ... Unpacking perl-modules-5.26 (5.26.1-6ubuntu0.3) ... Selecting previously unselected package libgdbm5:amd64. Preparing to unpack .../01-libgdbm5_1.14.1-6_amd64.deb ... Unpacking libgdbm5:amd64 (1.14.1-6) ... Selecting previously unselected package libgdbm-compat4:amd64. Preparing to unpack .../02-libgdbm-compat4_1.14.1-6_amd64.deb ... Unpacking libgdbm-compat4:amd64 (1.14.1-6) ... Selecting previously unselected package libperl5.26:amd64. Preparing to unpack .../03-libperl5.26_5.26.1-6ubuntu0.3_amd64.deb ... Unpacking libperl5.26:amd64 (5.26.1-6ubuntu0.3) ... Selecting previously unselected package perl. Preparing to unpack .../04-perl_5.26.1-6ubuntu0.3_amd64.deb ... Unpacking perl (5.26.1-6ubuntu0.3) ... Selecting previously unselected package mime-support. Preparing to unpack .../05-mime-support_3.60ubuntu1_all.deb ... Unpacking mime-support (3.60ubuntu1) ... Selecting previously unselected package libapr1:amd64. Preparing to unpack .../06-libapr1_1.6.3-2_amd64.deb ... Unpacking libapr1:amd64 (1.6.3-2) ... Selecting previously unselected package libexpat1:amd64. Preparing to unpack .../07-libexpat1_2.2.5-3ubuntu0.2_amd64.deb ... Unpacking libexpat1:amd64 (2.2.5-3ubuntu0.2) ... Selecting previously unselected package libssl1.1:amd64. Preparing to unpack .../08-libssl1.1_1.1.1-1ubuntu2.1~18.04.6_amd64.deb ... Unpacking libssl1.1:amd64 (1.1.1-1ubuntu2.1~18.04.6) ... Selecting previously unselected package libaprutil1:amd64. Preparing to unpack .../09-libaprutil1_1.6.1-2_amd64.deb ... Unpacking libaprutil1:amd64 (1.6.1-2) ... Selecting previously unselected package libsqlite3-0:amd64. Preparing to unpack .../10-libsqlite3-0_3.22.0-1ubuntu0.3_amd64.deb ... Unpacking libsqlite3-0:amd64 (3.22.0-1ubuntu0.3) ... Selecting previously unselected package libaprutil1-dbd-sqlite3:amd64. Preparing to unpack .../11-libaprutil1-dbd-sqlite3_1.6.1-2_amd64.deb ... Unpacking libaprutil1-dbd-sqlite3:amd64 (1.6.1-2) ... Selecting previously unselected package libroken18-heimdal:amd64. Preparing to unpack .../12-libroken18-heimdal_7.5.0+dfsg-1_amd64.deb ... Unpacking libroken18-heimdal:amd64 (7.5.0+dfsg-1) ... Selecting previously unselected package libasn1-8-heimdal:amd64. Preparing to unpack .../13-libasn1-8-heimdal_7.5.0+dfsg-1_amd64.deb ... Unpacking libasn1-8-heimdal:amd64 (7.5.0+dfsg-1) ... Selecting previously unselected package libheimbase1-heimdal:amd64. Preparing to unpack .../14-libheimbase1-heimdal_7.5.0+dfsg-1_amd64.deb ... Unpacking libheimbase1-heimdal:amd64 (7.5.0+dfsg-1) ... Selecting previously unselected package libhcrypto4-heimdal:amd64. Preparing to unpack .../15-libhcrypto4-heimdal_7.5.0+dfsg-1_amd64.deb ... Unpacking libhcrypto4-heimdal:amd64 (7.5.0+dfsg-1) ... Selecting previously unselected package libwind0-heimdal:amd64. Preparing to unpack .../16-libwind0-heimdal_7.5.0+dfsg-1_amd64.deb ... Unpacking libwind0-heimdal:amd64 (7.5.0+dfsg-1) ... Selecting previously unselected package libhx509-5-heimdal:amd64. Preparing to unpack .../17-libhx509-5-heimdal_7.5.0+dfsg-1_amd64.deb ... Unpacking libhx509-5-heimdal:amd64 (7.5.0+dfsg-1) ... Selecting previously unselected package libkrb5-26-heimdal:amd64. Preparing to unpack .../18-libkrb5-26-heimdal_7.5.0+dfsg-1_amd64.deb ... Unpacking libkrb5-26-heimdal:amd64 (7.5.0+dfsg-1) ... Selecting previously unselected package libheimntlm0-heimdal:amd64. Preparing to unpack .../19-libheimntlm0-heimdal_7.5.0+dfsg-1_amd64.deb ... Unpacking libheimntlm0-heimdal:amd64 (7.5.0+dfsg-1) ... Selecting previously unselected package libgssapi3-heimdal:amd64. Preparing to unpack .../20-libgssapi3-heimdal_7.5.0+dfsg-1_amd64.deb ... Unpacking libgssapi3-heimdal:amd64 (7.5.0+dfsg-1) ... Selecting previously unselected package libsasl2-modules-db:amd64. Preparing to unpack .../21-libsasl2-modules-db_2.1.27~101-g0780600+dfsg-3ubuntu2.1_amd64.deb ... Unpacking libsasl2-modules-db:amd64 (2.1.27~101-g0780600+dfsg-3ubuntu2.1) ... Selecting previously unselected package libsasl2-2:amd64. Preparing to unpack .../22-libsasl2-2_2.1.27~101-g0780600+dfsg-3ubuntu2.1_amd64.deb ... Unpacking libsasl2-2:amd64 (2.1.27~101-g0780600+dfsg-3ubuntu2.1) ... Selecting previously unselected package libldap-common. Preparing to unpack .../23-libldap-common_2.4.45+dfsg-1ubuntu1.5_all.deb ... Unpacking libldap-common (2.4.45+dfsg-1ubuntu1.5) ... Selecting previously unselected package libldap-2.4-2:amd64. Preparing to unpack .../24-libldap-2.4-2_2.4.45+dfsg-1ubuntu1.5_amd64.deb ... Unpacking libldap-2.4-2:amd64 (2.4.45+dfsg-1ubuntu1.5) ... Selecting previously unselected package libaprutil1-ldap:amd64. Preparing to unpack .../25-libaprutil1-ldap_1.6.1-2_amd64.deb ... Unpacking libaprutil1-ldap:amd64 (1.6.1-2) ... Selecting previously unselected package liblua5.2-0:amd64. Preparing to unpack .../26-liblua5.2-0_5.2.4-1.1build1_amd64.deb ... Unpacking liblua5.2-0:amd64 (5.2.4-1.1build1) ... Selecting previously unselected package libnghttp2-14:amd64. Preparing to unpack .../27-libnghttp2-14_1.30.0-1ubuntu1_amd64.deb ... Unpacking libnghttp2-14:amd64 (1.30.0-1ubuntu1) ... Selecting previously unselected package libicu60:amd64. Preparing to unpack .../28-libicu60_60.2-3ubuntu3.1_amd64.deb ... Unpacking libicu60:amd64 (60.2-3ubuntu3.1) ... Selecting previously unselected package libxml2:amd64. Preparing to unpack .../29-libxml2_2.9.4+dfsg1-6.1ubuntu1.3_amd64.deb ... Unpacking libxml2:amd64 (2.9.4+dfsg1-6.1ubuntu1.3) ... Selecting previously unselected package apache2-bin. Preparing to unpack .../30-apache2-bin_2.4.29-1ubuntu4.13_amd64.deb ... Unpacking apache2-bin (2.4.29-1ubuntu4.13) ... Selecting previously unselected package apache2-utils. Preparing to unpack .../31-apache2-utils_2.4.29-1ubuntu4.13_amd64.deb ... Unpacking apache2-utils (2.4.29-1ubuntu4.13) ... Selecting previously unselected package apache2-data. Preparing to unpack .../32-apache2-data_2.4.29-1ubuntu4.13_all.deb ... Unpacking apache2-data (2.4.29-1ubuntu4.13) ... Selecting previously unselected package apache2. Preparing to unpack .../33-apache2_2.4.29-1ubuntu4.13_amd64.deb ... Unpacking apache2 (2.4.29-1ubuntu4.13) ... Selecting previously unselected package libmagic-mgc. Preparing to unpack .../34-libmagic-mgc_1%3a5.32-2ubuntu0.4_amd64.deb ... Unpacking libmagic-mgc (1:5.32-2ubuntu0.4) ... Selecting previously unselected package libmagic1:amd64. Preparing to unpack .../35-libmagic1_1%3a5.32-2ubuntu0.4_amd64.deb ... Unpacking libmagic1:amd64 (1:5.32-2ubuntu0.4) ... Selecting previously unselected package file. Preparing to unpack .../36-file_1%3a5.32-2ubuntu0.4_amd64.deb ... Unpacking file (1:5.32-2ubuntu0.4) ... Selecting previously unselected package netbase. Preparing to unpack .../37-netbase_5.4_all.deb ... Unpacking netbase (5.4) ... Selecting previously unselected package openssl. Preparing to unpack .../38-openssl_1.1.1-1ubuntu2.1~18.04.6_amd64.deb ... Unpacking openssl (1.1.1-1ubuntu2.1~18.04.6) ... Selecting previously unselected package xz-utils. Preparing to unpack .../39-xz-utils_5.2.2-1.3_amd64.deb ... Unpacking xz-utils (5.2.2-1.3) ... Selecting previously unselected package libsasl2-modules:amd64. Preparing to unpack .../40-libsasl2-modules_2.1.27~101-g0780600+dfsg-3ubuntu2.1_amd64.deb ... Unpacking libsasl2-modules:amd64 (2.1.27~101-g0780600+dfsg-3ubuntu2.1) ... Selecting previously unselected package ssl-cert. Preparing to unpack .../41-ssl-cert_1.0.39_all.deb ... Unpacking ssl-cert (1.0.39) ... Setting up libapr1:amd64 (1.6.3-2) ... Setting up libexpat1:amd64 (2.2.5-3ubuntu0.2) ... Setting up libicu60:amd64 (60.2-3ubuntu3.1) ... Setting up libnghttp2-14:amd64 (1.30.0-1ubuntu1) ... Setting up mime-support (3.60ubuntu1) ... Setting up libldap-common (2.4.45+dfsg-1ubuntu1.5) ... Setting up libsasl2-modules-db:amd64 (2.1.27~101-g0780600+dfsg-3ubuntu2.1) ... Setting up libsasl2-2:amd64 (2.1.27~101-g0780600+dfsg-3ubuntu2.1) ... Setting up apache2-data (2.4.29-1ubuntu4.13) ... Setting up libroken18-heimdal:amd64 (7.5.0+dfsg-1) ... Setting up perl-modules-5.26 (5.26.1-6ubuntu0.3) ... Setting up libgdbm5:amd64 (1.14.1-6) ... Setting up libxml2:amd64 (2.9.4+dfsg1-6.1ubuntu1.3) ... Setting up libmagic-mgc (1:5.32-2ubuntu0.4) ... Setting up libmagic1:amd64 (1:5.32-2ubuntu0.4) ... Setting up libssl1.1:amd64 (1.1.1-1ubuntu2.1~18.04.6) ... debconf: unable to initialize frontend: Dialog debconf: (TERM is not set, so the dialog frontend is not usable.) debconf: falling back to frontend: Readline Setting up xz-utils (5.2.2-1.3) ... update-alternatives: using /usr/bin/xz to provide /usr/bin/lzma (lzma) in auto mode update-alternatives: warning: skip creation of /usr/share/man/man1/lzma.1.gz because associated file /usr/share/man/man1/xz.1.gz (of link group lzma) doesn't exist update-alternatives: warning: skip creation of /usr/share/man/man1/unlzma.1.gz because associated file /usr/share/man/man1/unxz.1.gz (of link group lzma) doesn't exist update-alternatives: warning: skip creation of /usr/share/man/man1/lzcat.1.gz because associated file /usr/share/man/man1/xzcat.1.gz (of link group lzma) doesn't exist update-alternatives: warning: skip creation of /usr/share/man/man1/lzmore.1.gz because associated file /usr/share/man/man1/xzmore.1.gz (of link group lzma) doesn't exist update-alternatives: warning: skip creation of /usr/share/man/man1/lzless.1.gz because associated file /usr/share/man/man1/xzless.1.gz (of link group lzma) doesn't exist update-alternatives: warning: skip creation of /usr/share/man/man1/lzdiff.1.gz because associated file /usr/share/man/man1/xzdiff.1.gz (of link group lzma) doesn't exist update-alternatives: warning: skip creation of /usr/share/man/man1/lzcmp.1.gz because associated file /usr/share/man/man1/xzcmp.1.gz (of link group lzma) doesn't exist update-alternatives: warning: skip creation of /usr/share/man/man1/lzgrep.1.gz because associated file /usr/share/man/man1/xzgrep.1.gz (of link group lzma) doesn't exist update-alternatives: warning: skip creation of /usr/share/man/man1/lzegrep.1.gz because associated file /usr/share/man/man1/xzegrep.1.gz (of link group lzma) doesn't exist update-alternatives: warning: skip creation of /usr/share/man/man1/lzfgrep.1.gz because associated file /usr/share/man/man1/xzfgrep.1.gz (of link group lzma) doesn't exist Setting up libaprutil1:amd64 (1.6.1-2) ... Setting up libheimbase1-heimdal:amd64 (7.5.0+dfsg-1) ... Setting up openssl (1.1.1-1ubuntu2.1~18.04.6) ... Setting up libsqlite3-0:amd64 (3.22.0-1ubuntu0.3) ... Setting up liblua5.2-0:amd64 (5.2.4-1.1build1) ... Setting up libgdbm-compat4:amd64 (1.14.1-6) ... Setting up libsasl2-modules:amd64 (2.1.27~101-g0780600+dfsg-3ubuntu2.1) ... Setting up netbase (5.4) ... Setting up libwind0-heimdal:amd64 (7.5.0+dfsg-1) ... Setting up libaprutil1-dbd-sqlite3:amd64 (1.6.1-2) ... Setting up apache2-utils (2.4.29-1ubuntu4.13) ... Setting up libasn1-8-heimdal:amd64 (7.5.0+dfsg-1) ... Setting up libhcrypto4-heimdal:amd64 (7.5.0+dfsg-1) ... Setting up ssl-cert (1.0.39) ... debconf: unable to initialize frontend: Dialog debconf: (TERM is not set, so the dialog frontend is not usable.) debconf: falling back to frontend: Readline Setting up file (1:5.32-2ubuntu0.4) ... Setting up libhx509-5-heimdal:amd64 (7.5.0+dfsg-1) ... Setting up libperl5.26:amd64 (5.26.1-6ubuntu0.3) ... Setting up libkrb5-26-heimdal:amd64 (7.5.0+dfsg-1) ... Setting up libheimntlm0-heimdal:amd64 (7.5.0+dfsg-1) ... Setting up perl (5.26.1-6ubuntu0.3) ... Setting up libgssapi3-heimdal:amd64 (7.5.0+dfsg-1) ... Setting up libldap-2.4-2:amd64 (2.4.45+dfsg-1ubuntu1.5) ... Setting up libaprutil1-ldap:amd64 (1.6.1-2) ... Setting up apache2-bin (2.4.29-1ubuntu4.13) ... Setting up apache2 (2.4.29-1ubuntu4.13) ... Enabling module mpm_event. Enabling module authz_core. Enabling module authz_host. Enabling module authn_core. Enabling module auth_basic. Enabling module access_compat. Enabling module authn_file. Enabling module authz_user. Enabling module alias. Enabling module dir. Enabling module autoindex. Enabling module env. Enabling module mime. Enabling module negotiation. Enabling module setenvif. Enabling module filter. Enabling module deflate. Enabling module status. Enabling module reqtimeout. Enabling conf charset. Enabling conf localized-error-pages. Enabling conf other-vhosts-access-log. Enabling conf security. Enabling conf serve-cgi-bin. Enabling site 000-default. invoke-rc.d: could not determine current runlevel invoke-rc.d: policy-rc.d denied execution of start. Processing triggers for libc-bin (2.27-3ubuntu1) ... Removing intermediate container a168d34f63ec ---> d890e403f31e Step 3/6 : RUN echo 'Hello World!' > /var/www/html/index.html ---> Running in 09bb45c5882e Removing intermediate container 09bb45c5882e ---> fe401addd6a4 Step 4/6 : RUN echo '. /etc/apache2/envvars' > /root/run_apache.sh && echo 'mkdir -p /var/run/apache2' >> /root/run_apache.sh && echo 'mkdir -p /var/lock/apache2' >> /root/run_apache.sh && echo '/usr/sbin/apache2 -D FOREGROUND' >> /root/run_apache.sh && chmod 755 /root/run_apache.sh ---> Running in 4eedec764d94 Removing intermediate container 4eedec764d94 ---> 0a5e0d04803f Step 5/6 : EXPOSE 80 ---> Running in 594dcc179290 Removing intermediate container 594dcc179290 ---> 3613355609ba Step 6/6 : CMD /root/run_apache.sh ---> Running in a7a3a282c05a Removing intermediate container a7a3a282c05a ---> 86eb988ce811 Successfully built 86eb988ce811 Successfully tagged hello-world:latest [ec2-user@amazonlinux2_vm docker]$ |
Docker イメージの一覧確認
docker images コマンドを実行して、イメージが正しく作成されたことを確認します。
1 |
$ docker images --filter reference=hello-world |
Docker イメージの実行
イメージからコンテナを作成して実行します。
docker run コマンドを実行すると、イメージからコンテナを作成して実行します。
-p 80:80 オプションは、コンテナ上の公開されたポート 80 をホストシステム上のポート 80 にマッピングします。
1 |
$ docker run -t -i -p 80:80 hello-world |
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
と表示されても無視してよいです。
ブラウザで、開いてみます。
・https://ipアドレス/
Hello World と表示されます。
コメント
[…] ・https://urashita.com/archives/32071 […]