iT邦幫忙

2018 iT 邦幫忙鐵人賽
DAY 15
0
Modern Web

每日文章推薦系列 第 15

Day 15 docker

好處

在linux下面的話不用跑vm就可以直接開一個環境

比之前方便很多

不用看VM在那邊吃記憶體跟CPU

雖然docker本身也會吃XD

infrastructure as code

是的

這個標題是從昨天的內容複製貼上過來的

從Dockerfile去把docker image編譯起來

也算是一種infrastructure as code

而且每次建立起來的image都是新的環境

所以可以確定環境的獨立性

不會被之前作過的操作所影響

Docker Compose

如果你要處理多個容器之間的連結

直接使用docker會感覺很麻煩

這時候就能使用docker-compose來作整合

可以把設定檔整合成一個yaml檔案

一次看懂你的系統要用到哪些service 跟image

也能直接設定好容器之間的連結

# Drupal with PostgreSQL
#
# Access via "http://localhost:8080"
#   (or "http://$(docker-machine ip):8080" if using docker-machine)
#
# During initial Drupal setup,
# Database type: PostgreSQL
# Database name: postgres
# Database username: postgres
# Database password: example
# ADVANCED OPTIONS; Database host: postgres

version: '3.1'

services:

  drupal:
    image: drupal:8.2-apache
    ports:
      - 8080:80
    volumes:
      - /var/www/html/modules
      - /var/www/html/profiles
      - /var/www/html/themes
      # this takes advantage of the feature in Docker that a new anonymous
      # volume (which is what we're creating here) will be initialized with the
      # existing content of the image at the same location
      - /var/www/html/sites
    restart: always

  postgres:
    image: postgres:9.6
    environment:
      POSTGRES_PASSWORD: example
    restart: always

https://docs.docker.com/samples/library/drupal/#-via-docker-stack-deploy-or-docker-compose

Kubernetes

Kubernetes是一个开源的,用于管理云平台中多个主机上的容器化的应用,Kubernetes的目标是让部署容器化的应用简单并且高效(powerful),Kubernetes提供了应用部署,规划,更新,维护的一种机制。https://www.kubernetes.org.cn/k8s

上面的docker-compose只限於在一台電腦裡面處理

當你需要用到cluster的狀況時

就要搭配Kubernetes 俗稱k8s來協助處理

docker 本身有推出Docker-swarm

但是一直沒打下市場

反倒是google 推動的k8s越來越多人用

現在在google cloud platform 上面的container container engine

更是直接改名成container Kubernetes engine

直接支援k8s的功能

之前就有支援啦

只是名字直接改成Kubernetes就更明顯了

而AWS也直接推出Amazon EKS

顯示出google,aws兩大雲端服務都已經覺得Kubernetes比較會有市場了

今日分享文章

今天看的文章

https://github.com/fripig/article_log/issues/423


上一篇
Day 14 Ansible
下一篇
Day 16 Open Space
系列文
每日文章推薦30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言