카타코더 Docker - Optimise Builds With Docker OnBuild

1 개요[ | ]

카타코더 Docker - Optimise Builds With Docker OnBuild
카타코더 Docker - Optimising Dockerfile with OnBuild
카타코더 Docker
# 🔗 제목
카타코더 Docker/1 e
🡵 카타코더 Docker - Deploying Your First Docker Container
🡵 카타코더 Docker - Deploy Static HTML Website as Container
🡵 카타코더 Docker - Building Container Images
🡵 카타코더 Docker - Dockerizing Node.js
🡵 카타코더 Docker - Optimise Builds With Docker OnBuild
🡵 카타코더 Docker - Ignoring Files During Build
🡵 카타코더 Docker - Create Data Containers
🡵 카타코더 Docker - Creating Networks Between Containers using Links
🡵 카타코더 Docker - Creating Networks Between Containers using Networks
🡵 카타코더 Docker - Persisting Data Using Volumes

2 Dockerfile 작성[ | ]

$ ll
total 44
drwxr-xr-x 1       501 staff     4096 Mar 22 15:21 ./
drwxr-xr-x 1 scrapbook scrapbook 4096 Mar 22 15:21 ../
-rw-r--r-- 1       501 staff       50 Jun 27  2015 .gitignore
-rw-r--r-- 1 root      root        32 Mar 22 15:21 Dockerfile
-rw-r--r-- 1       501 staff       74 Jun 27  2015 Makefile
-rw-r--r-- 1       501 staff     1478 Jun  4  2015 app.js
drwxr-xr-x 2       501 staff     4096 Mar 22 15:21 bin/
-rw-r--r-- 1       501 staff      357 Jun  4  2015 package.json
drwxr-xr-x 5       501 staff     4096 Mar 22 15:21 public/
drwxr-xr-x 2       501 staff     4096 Mar 22 15:21 routes/
drwxr-xr-x 2       501 staff     4096 Jun  4  2015 views/
Dockerfile
FROM node:7-onbuild
EXPOSE 3000

3 빌드 및 실행[ | ]

$ docker build -t my-nodejs-app .
Sending build context to Docker daemon  17.92kB
Step 1/2 : FROM node:7-onbuild
7-onbuild: Pulling from library/node
ad74af05f5a2: Pull complete
2b032b8bbe8b: Pull complete
a9a5b35f6ead: Pull complete
3245b5a1c52c: Pull complete
afa075743392: Pull complete
9fb9f21641cd: Pull complete
3f40ad2666bc: Pull complete
49c0ed396b49: Pull complete
7af304825012: Pull complete
Digest: sha256:e506d4de7f21fc0cf51e2d2f922eb0349bd2c07f39dd6335e4338f92c9408994
Status: Downloaded newer image for node:7-onbuild
# Executing 5 build triggers
 ---> Running in 18f431a8b01d
Removing intermediate container 18f431a8b01d
 ---> Running in 0cef8c1dea5b
Removing intermediate container 0cef8c1dea5b
 ---> Running in 79eb18c4ac7a
npm info it worked if it ends with ok
npm info using npm@4.2.0
npm info using node@v7.10.1
npm info attempt registry request try #1 at 3:24:52 PM
npm http request GET https://registry.npmjs.org/express
npm info attempt registry request try #1 at 3:24:52 PM
npm http request GET https://registry.npmjs.org/body-parser
npm info attempt registry request try #1 at 3:24:52 PM
npm http request GET https://registry.npmjs.org/cookie-parser
npm info attempt registry request try #1 at 3:24:52 PM
npm http request GET https://registry.npmjs.org/morgan
npm info attempt registry request try #1 at 3:24:52 PM
npm http request GET https://registry.npmjs.org/serve-favicon
npm info attempt registry request try #1 at 3:24:52 PM
npm http request GET https://registry.npmjs.org/debug
npm info attempt registry request try #1 at 3:24:52 PM
npm http request GET https://registry.npmjs.org/jade
npm http 200 https://registry.npmjs.org/cookie-parser
npm http 200 https://registry.npmjs.org/serve-favicon
npm http 200 https://registry.npmjs.org/morgan
npm http 200 https://registry.npmjs.org/body-parser
npm http 200 https://registry.npmjs.org/jade
...
+-- morgan@1.3.2
| `-- basic-auth@1.0.0
`-- serve-favicon@2.1.7
  `-- etag@1.5.1
    `-- crc@3.2.1

npm info ok
npm info it worked if it ends with ok
npm info using npm@4.2.0
npm info using node@v7.10.1
npm WARN using --force I sure hope you know what you are doing.
npm info ok
Removing intermediate container 79eb18c4ac7a
 ---> d483ac9ef2f7
Step 2/2 : EXPOSE 3000
 ---> Running in f09417210136
Removing intermediate container f09417210136
 ---> de59fbafe1e9
Successfully built de59fbafe1e9
Successfully tagged my-nodejs-app:latest
$ docker run -d --name my-running-app -p 3000:3000 my-nodejs-app
91ca59425f84fa3e4884b564f2ceef51eeb0847f07e30740e2e9c62b9ac6f24a
$ curl http://docker:3000
<!DOCTYPE html><html><head><title>Express</title><link rel="stylesheet" href="/stylesheets/style.css"></head><body><h1>Express</h1><p>Welcome to Express</p></body></html>
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}