「[[マイクロソフト系技術情報 Wiki>http://techinfoofmicrosofttech.osscons.jp/]]」は、「[[Open棟梁Project>https://github.com/OpenTouryoProject/]]」,「[[OSSコンソーシアム .NET開発基盤部会>https://www.osscons.jp/dotNetDevelopmentInfrastructure/]]」によって運営されています。

-[[戻る>コンテナ技術]]
--[[Docker for Windows]]
--[[Windows Serverコンテナ]]
--[[Windows Subsystem for Linux]]

* 目次 [#p71f6db0]
#contents

*概要 [#u74b06d2]
2.0.0.2 から Docker Desktop for Windowsにリネーム

-旧名称は[[Desktop with integrated Kubernetes>#u51cfd19]]

-本バージョンから、
--[[K8s>#u51cfd19]]
--[[WSL2>#a4fac57b]]
--[[Windows Serverコンテナ>#l3cc3544]]自体

>がサポートされるようになった。

-[[詳細>#yea6250f]]
-[[有償化>#m40e5547]]
--[[Java有償化>https://dotnetdevelopmentinfrastructure.osscons.jp/index.php?Java%E6%9C%89%E5%84%9F%E5%8C%96%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6%E8%AA%BF%E3%81%B9%E3%81%A6%E3%81%BF%E3%81%9F%E3%80%82]]っぽい雰囲気。

--2021/8/31発表、
---2021/8/31から開始
---2022/1/31までが猶予期間

*詳細 [#yea6250f]

**[[インストール>Docker for Windows#ib6bc582]] [#d3a907b0]

**有償化 [#m40e5547]

***回避 [#zb156b47]
-[[Hyper-V]]や[[WSL2>WSL → WSL2]]で[[Docker>#c8f9ceae]]を使う。

-[[WSL2>WSL → WSL2]]で[[Docker>#c8f9ceae]]を使えるようになったので、~
[[ファイルシステムやネットワーク的には、より便利になった面も。>WSL → WSL2#yf2b317a]]

-参考 :
-- [[WSL → WSL2 > 試用、評価 > Dockerサポート2>WSL → WSL2#x1a53d68]]
--[[Visual StudioのDockerサポートはどうなったか?>Visual Studio Kubernetes Tools#nb71a05a]]

***参考 [#ydc8ed98]
-Docker Desktopが有料化へ 従業員数250人未満~
年間売り上げ1000万ドル未満の組織などは引き続き無料 - ITmedia NEWS~
https://www.itmedia.co.jp/news/articles/2109/02/news112.html
-Docker Desktopが有料化へ、ただし250人未満かつ~
年間売り上げ1000万ドル(約11億円)未満の組織や~
個人やオープンソースプロジェクトでは引き続き無料で利用可能 - Publickey~
https://www.publickey1.jp/blog/21/docker_desktop250100011.html

**機能 [#yf28bc18]

***[[Desktop with integrated Kubernetes>Docker for Windows#md8e77bf]] [#u51cfd19]
ローカルの[[Docker for Windows]]で[[K8s>#ad01d6b3]]が動作する。

***[[Docker Desktop WSL2 Backend>WSL → WSL2#yac68e0f]] [#a4fac57b]
-[[WSL(1)>Windows Subsystem for Linux]] に [[Docker>https://dotnetdevelopmentinfrastructure.osscons.jp/index.php?Docker]]を入れるという[[裏技>Windows上で動くLinux#yc05e4f9]]もあったけど、

-[[WSL2>#mb6cff6e]]はVM上で動くようになったので[[Docker>#c8f9ceae]]が安定して動作するようになった。~
(Linuxのファンクションコールに強く依存する[[Docker>#c8f9ceae]]などは[[WSL(1)>Windows Subsystem for Linux]]で動作しなかった。)

-[[Docker Desktop WSL2 Backend>WSL → WSL2#yac68e0f]]は、読んで字の如く、~
WSL2(Backend)上の[[Docker>#c8f9ceae]]を、Docker Desktop for Windowsから使用するもの。

*動確 [#oc28a02b]

**[[K8s>#nb6df1d5]] [#ad01d6b3]

***有効化と有効化の確認 [#k652d2a1]
-[[K8s>#nb6df1d5]]と[[Compose on Kubernetes>#x191bff2]]を有効化して再起動。
#ref(enable.png,left,nowrap,K8sの有効化,60%)

-有効化された事を確認する。

>
 >kubectl get componentstatuses
 Unable to connect to the server: dial tcp [::1]:8080: connectex: No connection could be made because the target machine actively refused it.

>↓ ↓ ↓

>
 >kubectl get componentstatuses
 NAME                 STATUS    MESSAGE             ERROR
 scheduler            Healthy   ok
 controller-manager   Healthy   ok
 etcd-0               Healthy   {"health":"true"}

***[[K8s>#nb6df1d5]]ダッシュボードをデプロイ [#k1b1bc9c]
-デプロイの実行
 >kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml
 secret/kubernetes-dashboard-certs created
 serviceaccount/kubernetes-dashboard created
 role.rbac.authorization.k8s.io/kubernetes-dashboard-minimal created
 rolebinding.rbac.authorization.k8s.io/kubernetes-dashboard-minimal created
 deployment.apps/kubernetes-dashboard created
 service/kubernetes-dashboard created

-デプロイの確認
 >kubectl get deployment --namespace=kube-system -l k8s-app=kubernetes-dashboard
 NAME                   READY   UP-TO-DATE   AVAILABLE   AGE
 kubernetes-dashboard   1/1     1            1           23s

-ローカルホストからKubernetesダッシュボードにアクセスするプロキシを起動
 >kubectl proxy
 Starting to serve on 127.0.0.1:8001

>※ このコマンド(プロキシ)は、実行状態のままにしておく。

-この状態で、以下のURLにアクセスすると、~
ダッシュボードにアクセスできるが、初期設定が必要。
>http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/

-初期設定手順がLinuxコマンドなので[[WSL>Windows Subsystem for Linux]]に移動する。

--初めに、以下の手順で、WSLでkubectlを利用できるようにする。

---WSLのターミナルからkubectlのインストール。
 $ curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
 $ chmod +x kubectl
 $ sudo mv kubectl /usr/local/bin/kubectl

---kube configファイルをコピー
 $ mkdir ~/.kube
 $ cp /mnt/c/Users/<username>/.kube/config ~/.kube

---kubectlの実行確認
 $ kubectl version
 Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.2", GitCommit:"52c56ce7a8272c798dbc29846288d7cd9fbae032", GitTreeState:"clean", BuildDate:"2020-04-16T11:56:40Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
 Server Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.5", GitCommit:"20c265fef0741dd71a66480e35bd69f18351daea", GitTreeState:"clean", BuildDate:"2019-10-15T19:07:57Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"linux/amd64"}

--以下のLinuxコマンドを実行してTokenを生成する。
 $ kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep oke-admin | awk '{print $1}')

-改めて、ダッシュボードにアクセスする。

--生成されたTokenを入力してサインインする。
---ちなみに、このToken、分析してみると、[[RS256のJWS>JWS#xe033b54]]でした。~
---ただし、[[K8s>#u51cfd19]]は、Resource Serverではないと言う事で、~
このTokenは[[OAuth2/OIDC>OpenID / OAuth / OpenID Connect]]のTokenではないらしい。
#ref(login.png,left,nowrap,K8sダッシュボードにサインイン,60%)

--ダッシュボードの表示を確認する。
#ref(dashboard.png,left,nowrap,K8sダッシュボードの表示,60%)

***アプリケーションのデプロイ [#s405cdff]
-[[Compose on Kubernetes>#x191bff2]]でdocker-compose.ymlをデプロイ

--[[Compose on Kubernetes>#x191bff2]] ≒ docker stackコマンドということらしい。

--以下のようにスタックをデプロイするらしい。
 docker stack deploy --compose-file docker-compose.yml mystack

-[[下記の参考サイト>#nb6df1d5]]の情報から、~
以下のようにdocker-compose.ymlを作成した。
--C:\<current_directory>\docker-compose.ymlに作成。
--ポートはIISがインストールされているので8888に変更。
 version: '3.3'
 
 services:
   web:
     build: web
     image: dockerdemos/lab-web
     volumes:
      - "/C:/<current_directory>/web/static/:/static"
     ports:
      - "8888:80"
 
   words:
     build: words
     image: dockerdemos/lab-words
     deploy:
       replicas: 1
       endpoint_mode: dnsrr
       resources:
         limits:
           memory: 24M
         reservations:
           memory: 24M
 
   db:
     build: db
     image: dockerdemos/lab-db

--実際に、スタックをデプロイしてみる。
 >docker stack deploy --compose-file docker-compose.yml mystack
 Ignoring unsupported options: build
 
 service "web": build is ignored
 service "words": build is ignored
 service "db": build is ignored
 Waiting for the stack to be stable and running...
 words: Ready            [pod status: 1/1 ready, 0/1 pending, 0/1 failed]
 web: Ready              [pod status: 1/1 ready, 0/1 pending, 0/1 failed]
 db: Ready               [pod status: 1/1 ready, 0/1 pending, 0/1 failed]
 
 Stack mystack is stable and running

--以下のアドレスにアクセスしてみるとアプリが起動する。
---画面に表示される単語が時間で切替わる。
---これは、[[WebAPI]]経由でDBから取得しているらしい。
>http://localhost:8888/

--以下のコマンドでpodが確認できる。
 >kubectl get pod
 NAME                     READY   STATUS    RESTARTS   AGE
 db-5ff65ccc84-d5z6l      1/1     Running   0          63m
 web-79fd4ff54f-rqlkh     1/1     Running   0          63m
 words-76f98fb794-6rvvf   1/1     Running   1          63m

--以下のコマンドでデプロイしたスタックを確認できる。
 >docker stack ls
 NAME                SERVICES            ORCHESTRATOR        NAMESPACE
 mystack             3                   Kubernetes          default

--最後に、デプロイしたスタックを削除する。
 docker stack rm mystack

-同様に、[[コレ(azure-voting-app-redis)>Visual Studio Kubernetes Tools#q9416ca2]]を起動してみた。

--スタックをデプロイしてみる。
 >docker stack deploy --compose-file docker-compose.yaml mystack
 Ignoring unsupported options: build
 
 Igninoring deprecated options:
 
 container_name: Setting the container name is not supported.
 
 service "azure-vote-back": container_name is deprecated
 service "azure-vote-front": container_name is deprecated
 service "azure-vote-front": build is ignored
 Waiting for the stack to be stable and running...
 azure-vote-back: Ready          [pod status: 1/1 ready, 0/1 pending, 0/1 failed]
 azure-vote-front: Ready         [pod status: 1/1 ready, 0/1 pending, 0/1 failed]
 
 Stack mystack is stable and running
※ &color(red){build is ignored};(docker build のセクションが無視されるの)で、~
  azure-vote-frontが、&color(red){Pending};のままになることがあるので[[注意>https://dotnetdevelopmentinfrastructure.osscons.jp/index.php?Compose%20on%20Kubernetes#n079b830]]。

--アクセスする。~
リンク先を辿ると解るのだケド、URLは以下。
>http://localhost:8080/

--デプロイしたスタックを削除する。
 docker stack rm mystack

**その他 [#ob736c8b]

***[[WSL2 backend>#b6917977]] [#mb6cff6e]
[[コチラ>WSL → WSL2#n5e68ec0]]

***[[Windows Serverコンテナ>#n8b48390]] [#l3cc3544]
[[コチラ>Windows Serverコンテナ#a3130121]]

*参考 [#u19041cd]

**新規サポートの追加要素 [#k9ed4071]

***[[K8s>Visual Studio Kubernetes Tools#x4a72daa]] [#nb6df1d5]
[[K8s>#nb6df1d5]] on [[Docker Desktop for Windows]]

-【3分でできる!】Docker Desktop for Windowsの~
Kubernetesにダッシュボードをインストールする | Skyarch Broadcasting~
https://www.skyarch.net/blog/?p=16378

-Docker for Windows Desktopのk8sで~
アプリを動かしてみる - ソフト開発お仕事メモ🐕~
https://sekom.hatenablog.com/entry/2018/06/16/000000

***[[WSL2>Windows Subsystem for Linux#t1ddb916]] [#b6917977]

***[[Windows Serverコンテナ]] [#n8b48390]

**docker.com [#a59cb50e]

***Blog [#md692ab3]
-5 Things to Try with Docker Desktop WSL 2 Tech Preview - Docker Blog~
https://www.docker.com/blog/5-things-docker-desktop-wsl2-tech-preview/

-Docker ❤️ WSL 2 - The Future of Docker Desktop for Windows - Docker Engineering Blog~
https://engineering.docker.com/2019/06/docker-hearts-wsl-2/

***Docker Documentation [#vaeb5b0b]
-Get started with Docker for Windows~
https://docs.docker.com/docker-for-windows/
--Docker Desktop WSL 2 backend~
https://docs.docker.com/docker-for-windows/wsl-tech-preview/

**Publickey [#q2686abd]
-Docker社、WSL 2に最適化した「Docker Desktop for WSL 2」来月リリース。~
Windows 10でLinux版Dockerを実現、Kubernetesも1クリックでセットアップ~
https://www.publickey1.jp/blog/19/dockerwsl_2docker_desktop_for_wsl_2windows_10linuxdockerkubernetes1.html

**CL LAB [#r9bf5703]
クリエーションライン株式会社 #docker

-Linuxコンテナをネイティブに実行できる、~
Docker Desktop for WSL 2テクノロジープレビューのご案内~
https://www.creationline.com/lab/29090

-Docker Desktop for WSL 2テクノロジープレビューを試す5つの理由~
https://www.creationline.com/lab/29369

**@IT [#g47617cd]
-開発者に朗報! Windows 10でWindows Serverコンテナが実行可能に (1/2)~
:企業ユーザーに贈るWindows 10への乗り換え案内(42)~
https://www.atmarkit.co.jp/ait/articles/1902/07/news024.html

-「Docker Desktop for WSL 2」、2019年7月に~
テクニカルプレビュー版がリリース:DockerがWSL 2を利用~
https://www.atmarkit.co.jp/ait/articles/1906/19/news074.html

**Qiita [#m60e2b86]

***[[K8s>#nb6df1d5]] [#g8f63604]
-Docker for Windows で Kubernetes~
--(1)~
https://qiita.com/tksarah/items/ba51f1120d5d7ac0435f
--(2)~
https://qiita.com/tksarah/items/a0e5bcd5930310ffb08c

-Docker for WindowsでKubernetesを試してみる~
https://qiita.com/h-r-k-matsumoto/items/68f694650029ddf7351d

-[Docker for Windows]Kubernetesを動かしてみる~
https://qiita.com/icck/items/91eac9da094666e47c62

***[[WSL2>WSL → WSL2#l9cf3db0]] [#va3bd8df]

**開発基盤部会 Wiki [#df36c0f9]

***[[Docker>https://dotnetdevelopmentinfrastructure.osscons.jp/index.php?Docker]] [#c8f9ceae]

***[[Dockerコンポーズ>https://dotnetdevelopmentinfrastructure.osscons.jp/index.php?Docker%E3%82%B3%E3%83%B3%E3%83%9D%E3%83%BC%E3%82%BA]] [#yf31ce4e]

***[[Kompose>https://dotnetdevelopmentinfrastructure.osscons.jp/index.php?Kompose]] [#o759b91a]

***[[Compose on Kubernetes>https://dotnetdevelopmentinfrastructure.osscons.jp/index.php?Compose%20on%20Kubernetes]] [#x191bff2]

----
Tags: [[:Windows]], [[:Hyper-V]], [[:仮想化]], [[:コンテナ]]

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS