"카타코더 Docker - Building Container Images"의 두 판 사이의 차이

 
(같은 사용자의 중간 판 8개는 보이지 않습니다)
1번째 줄: 1번째 줄:
==개요==
==개요==
{{Katacoda|Docker & Containers|1}}
;카타코더 Docker - Building Container Images


==Creating a Dockerfile==
{{카타코더|Docker|1}}
 
==Dockerfile 작성==
<source lang='console'>
$ ll
total 16
drwxr-xr-x 1 scrapbook scrapbook 4096 Mar 22 15:20 ./
drwxr-xr-x 1 scrapbook scrapbook 4096 Jun  8  2018 ../
-rw-r--r-- 1 root      root      121 Mar 22 15:20 Dockerfile
-rw-r--r-- 1 root      root        21 Mar 22 15:20 index.html
</source>
<source lang='console'>
<source lang='console'>
$ cat index.html
$ cat index.html
16번째 줄: 26번째 줄:
</source>
</source>


==Building Containers==
==컨테이드 빌드==
<source lang='console'>
<source lang='console'>
$ docker images
$ docker images
53번째 줄: 63번째 줄:
</source>
</source>


==Launching New Image==
==이미지 실행하기==
<source lang='console'>
<source lang='console'>
$ docker run -d -p 80:80 nginx
$ docker run -d -p 80:80 nginx

2019년 3월 23일 (토) 19:31 기준 최신판

1 개요[ | ]

카타코더 Docker - Building Container Images
카타코더 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 16
drwxr-xr-x 1 scrapbook scrapbook 4096 Mar 22 15:20 ./
drwxr-xr-x 1 scrapbook scrapbook 4096 Jun  8  2018 ../
-rw-r--r-- 1 root      root       121 Mar 22 15:20 Dockerfile
-rw-r--r-- 1 root      root        21 Mar 22 15:20 index.html
$ cat index.html
<h1>Hello World</h1>
Dockerfile
FROM nginx:1.11-alpine
COPY index.html /usr/share/nginx/html/index.html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

3 컨테이드 빌드[ | ]

$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
$ docker build -t nginx .
Sending build context to Docker daemon  3.072kB
Step 1/4 : FROM nginx:1.11-alpine
1.11-alpine: Pulling from library/nginx
709515475419: Pull complete
4b21d71b440a: Pull complete
c92260fe6357: Pull complete
ed383a1b82df: Pull complete
Digest: sha256:5aadb68304a38a8e2719605e4e180413f390cd6647602bee9bdedd59753c3590
Status: Downloaded newer image for nginx:1.11-alpine
 ---> bedece1f06cc
Step 2/4 : COPY index.html /usr/share/nginx/html/index.html
 ---> ff82266f8a3c
Step 3/4 : EXPOSE 80
 ---> Running in 75539b6235b5
Removing intermediate container 75539b6235b5
 ---> b06ce6726b2a
Step 4/4 : CMD ["nginx", "-g", "daemon off;"]
 ---> Running in df877b3d066b
Removing intermediate container df877b3d066b
 ---> a2272ce5f857
Successfully built a2272ce5f857
Successfully tagged nginx:latest
$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
nginx               latest              a2272ce5f857        7 seconds ago       54.3MB
nginx               1.11-alpine         bedece1f06cc        23 months ago       54.3MB

4 이미지 실행하기[ | ]

$ docker run -d -p 80:80 nginx
45afb3ea6530661117140229e1959133552d8d31c45cfa72d27b957c6444d0a6
$ curl -i http://docker
HTTP/1.1 200 OK
Server: nginx/1.11.13
Date: Fri, 22 Mar 2019 15:08:40 GMT
Content-Type: text/html
Content-Length: 21
Last-Modified: Fri, 22 Mar 2019 14:57:48 GMT
Connection: keep-alive
ETag: "5c94f7ec-15"
Accept-Ranges: bytes

<h1>Hello World</h1>
$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS      PORTS                         NAMES
45afb3ea6530        nginx               "nginx -g 'daemon of…"   47 seconds ago      Up 45 seconds      0.0.0.0:80->80/tcp, 443/tcp   boring_kare

5 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}