Docker Container Linux LXC Lib Container Docker Image
Docker Container Linux LXC Lib. Container
Docker Image Docker containers wrap up a piece of software in a complete filesystem that contains everything it needs to run: code, runtime, system tools, system libraries Image Container
Docker Image vs Container An instance of an image is called container
VM vs Docker Container
Docker Hub https: //hub. docker. com/explore/
Docker Hub https: //hub. docker. com/explore/
Dockerfile – Hello Openshift https: //hub. docker. com/r/openshift/hello-openshift/ 베이스 이미지 [root@master ~]# cat Dockerfile FROM scratch 만든사람 MAINTAINER Jessica Forrester jforrest@redhat. com 넣을 파일 ADD bin/hello-openshift 사용할 포트 EXPOSE 8080 8888 실행할 파일 ENTRYPOINT ["/hello-openshift"]
Dockerfile – Hello Openshift 이미지 생성 [root@hsyangpc hello-openshift]# docker build -t my-hello-openshift. Sending build context to Docker daemon 6. 594 MB Step 0 : FROM scratch Step 1 : MAINTAINER Jessica Forrester <jforrest@redhat. com> … Step 4 : ENTRYPOINT /hello-openshift … Successfully built ec 2 eb 0 e 5676 f [root@hsyangpc hello-openshift]# docker images REPOSITORY TAG IMAGE ID my-hello-openshift latest ec 2 eb 0 e 5676 f CREATED 40 seconds ago VIRTUAL SIZE 6. 517 MB
Dockerfile – Hello Openshift 실행결과 [root@hsyangpc hello-openshift]# docker run -d my-hello-openshift c 2 c 82 f 8 f 8 dc 6 b 37 e 52 eb 517 dd 3 e 294 d 149443 e 04860 ef 0356 c 186 cdd 55 e 7 df 3 f # 현재 실행중인 Container 조회 [root@hsyangpc hello-openshift]# docker ps c 2 c 82 f 8 f 8 dc 6 my-hello-openshift 3 minutes ago hello-openshift Up 3 minutes # 컨테이너 IP 정보조회 [root@hsyangpc hello-openshift]# docker inspect my-hello-openshift. . . "IPAddress": "172. 17. 0. 4", . . . "8080/tcp": null, "8888/tcp": null [root@hsyangpc hello-openshift]# curl -v 172. 17. 0. 4: 8080 Hello Open. Shift! 8080/tcp, 8888/tcp my-
Hello-world [root@hsyangpc hello-world]# docker run my-hello-world Hello from Docker. This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. . . For more examples and ideas, visit: https: //docs. docker. com/engine/userguide/ [root@hsyangpc hello-world]#
Dockerfile – Apache Webserver [root@master ~]# cat Dockerfile FROM docker. io/centos USER root RUN yum -y install tar unzip vi vim telnet … COPY files/jboss-ews-httpd-2. 1. 0. zip /tmp/ RUN cd /opt; unzip /tmp/jboss-ews-httpd-2. 1. 0. zip WORKDIR /opt/jboss-ews-2. 1/httpd RUN. /. postinstall … EXPOSE 80 CMD ["/opt/jboss-ews-2. 1/httpd/sbin/apachectl", "-k", "start", "-D", "FOREGROUND"]
Docker Build [root@master ~]# docker build -t ews 21. … [root@master ~]# docker images REPOSITORY TAG ews 21 latest docker. io/centos 6. 6 IMAGE ID CREATED VIRTUAL SIZE 47 bd 98336 d 1 d 3 days ago 443. 1 MB 12 c 9 d 795 d 85 a 6 months ago 202. 6 MB [root@master ~]# docker run -d --privileged -p 80: 80 -h web 1 ews 21
Apache Webserver 컨테이너 접속 # 실행중인 컨테이너 조회 [root@master ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d 1 e 70 a 6 efdac ews 21 "/opt/jboss-ews-2. 1/httpd/sbin/apachectl" 16 minutes ago minutes 80/tcp tender_albattani # 컨테이너 내부로 접속 [root@master ~]# docker exec -ti d 1 e 70 a 6 efdac /bin/bash [root@tender_albattani~]# Up 16
S 2 I Builder Git. Lab Source 다운로드 Builder Image 생성 Image Tool 다운로드: https: //github. com/openshift/source-to-image/releases https: //blog. openshift. com/create-s 2 i-builder-image/ # s 2 i create eap 64 -builder # s 2 i build test/test-app/ eap 64 -builder eap 64 -app 1 추가되는 파일 /usr/local/s 2 i/ assemble run …
Guideline for Building Image https: //docs. openshift. com/container-platform/3. 3/creating_images/guidelines. html#openshiftcontainer-platform-specific-guidelines Reuse Images Maintain Compatibility Within Tags Avoid Multiple Processes Clean Temporary Files Minimize the number of layers Support Arbitrary User IDs
Open. Shift
Docker and Openshift Docker Openshift Image Container / Pod Service 10. 1. 2. 10: 80, 10. 1. 3. 13: 80 172. 30. 35. 131 Route ews 21. test. rockplace. co. kr
Openshift User and Project Resources Route Service User Project Pod role Resource. Quota Limit. Range Deployment Config Build. Config
Openshift User and Projects
Container Management by Openshift Route: ews 21 외부로부터의 진입점 ews 21. test. rockplace. co. kr Docker Image service: ews 21 172. 30. 176. 102 Cluster IP (VIP)를 통한 Loadbalancing Pod Kubernetes는 Container를 Pod에 담아서 관리 Replication. Controller 지정된 개수의 Pod가 잘 돌고 있는지… Deployment. Config 몇 개의 Pod를 만들지… 어떻게 Rebuild 할지…
Container Resource Limit Resource. Quota Limit. Range { { "kind": "Limit. Range", "api. Version": "v 1", "metadata": { "name": “ews 21 }, "spec": { "limits": [ { "type": "Pod", "max": { "cpu": "1000 m", "memory": "2 Gi" }, "min": { "cpu": "500 m", "memory": "1 Gi" } }, "api. Version": "v 1", "kind": "Resource. Quota", "metadata": { "name": “ews 21" }, "spec": { "hard": { "memory": "8 Gi", "cpu": "10", "pods": "10", "services": "10" } } } …
Creating Application in Openshift Docker Build Use Dockerfile S 2 I Image Builder Use Dockerfile, S 2 I Tool, Source Url / Path Template Input all required parameters and resources
Open. Shift runs on your choice of infrastructure RHEL 7. 1 또는 RHEL Atomic Host 7. 1. 6
Nodes are instances of RHEL where apps will run 최초 설치 후 모습
Pods run one or more docker containers as a unit 스케일링되는 가장 작은 단위: POD
Pod placement is determined based on defined policy Region 및 Zone 지정 가능 스케쥴러에 의해 선택
Services allow related pods to connect to each other
Management/Replication controller manages the pod lifecycle
What if a pod goes down?
Open. Shift automatically recovers and deploys a new Pod
Pods can attach to shared storage for stateful services
Routing layer routes external app requests to pods
Developers access Open. Shift via Web, CLI or IDE
Remote Shell & Resource Usage Metrics ● Connect to a container easily via a remote shell in the web console ● Productize and stabilize Heapster ● Connect it to Hawkular (and therefore Cassandra) ● Container metrics from cgroups (via the Heapster data model) 관리콘솔로 본 Pod
Topology & Logging ● Topology view to the web console - see a graph of all your resources ● Productize images for Elasticsearch, Fluentd, and Kibana ● Full build, deploy, docker (std error/out) log consolidation for admins ● Developer gets real-time logs to console 사용자 – 프로젝트 - Pod 토폴로지 구조
Custom JBoss Image 활용 Apache – Jboss 가 연동되어있는 플랫폼 이미지 생성 Project생성 [root@master ~]# oc new-project jboss-eap Now using project "jboss-eap" on server "https: //master. example. com: 8443" 웹서버-Ews 21 생성 [root@master ~]# oc new-app openshift/ews 21 --> Found image 47 bd 983 (4 days old) in image stream "ews 21 in project openshift" … 외부 서비스노출 Jboss-Eap 64 생성 [root@master ~]# oc expose service ews 21 route "ews 21" exposed [root@master ~]# oc new-app openshift/eap 64 --> Found image 39 efc 72 (4 days old) in image stream "eap 64 in project openshift". .
Sample Project
Sample Project - Topology Route: ews 21 -jboss-eap. test. rockplace. co. kr service: eap 64 172. 30. 66. 29 service: ews 21 172. 30. 176. 102 Replication. Controller pod: eap 64 -1 -aetyv 10. 1. 2. 15 pod: ews 21 -1 -lascd 10. 1. 3. 15 Deployment. Config Replication. Controller
Differences between EAP and EAP x. Paa. S Image
감사합니다 cloud@rockplace. co. kr
- Slides: 44