るぷぶろぐ -41ページ目

Dockerについて パート002


Windows 10 の Windows コンテナー

●はじめに

 

windowsのコンテナを試す場合は、コンテナの切り替えが必要みたいです。
切り替えの方法は右下のタスクアイコンより、Docker for Windowsで右クリックを押下して、メニューを表示し、Switch to Windows Containers…」 を実行すると、数秒後に交換されます。

そして、linux系を使用したい場合は、同じメニューの場所が「Switch to Linux Containers…」となっているので、同じように実行すると、元に戻ります。


●cmdの立ち上げ

Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.



C:\WINDOWS\system32>docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE


●dockerイメージのダウンロード

C:\WINDOWS\system32>docker pull microsoft/nanoserver
Using default tag: latest
latest: Pulling from microsoft/nanoserver
bce2fbc256ea: Downloading
4a8c367fd46d: Downloading
unknown blob

 ⇒★しかし、エラーぽい。(unknown blob)


●念のために確認。

C:\WINDOWS\system32>docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

C:\WINDOWS\system32>docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

 ⇒★だね。

●dockerの情報

C:\WINDOWS\system32>docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 17.03.1-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host ipvlan macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: xxxxxxxxxxxxxxxxxxxxxxxxxxx
runc version: xxxxxxxxxxxxxxxxxxxxxxxxxxx
init version: xxxxxxxxx
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.27-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.934 GiB
Name: moby
ID: xxxxxxxxxxxxxxxxxxxxxxxxxxx
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 13
 Goroutines: 21
 System Time: 2017-05-25T13:39:06.6391235Z
 EventsListeners: 0
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false


●docker のサンプル(hello-world)

C:\WINDOWS\system32>docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
78445dd45222: Pull complete
Digest: sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7
Status: Downloaded newer image for hello-world:latest

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.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://cloud.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/engine/userguide/


 ⇒★実行結果を表示

●さらに確認

C:\WINDOWS\system32>docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              48b5124b2768        4 months ago        1.84 kB

C:\WINDOWS\system32>docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

 ⇒★イメージとしては保存済み。実行中としては、出力したら終了の為、プロセスはなし。


●ubuntuとbashをサンプル実行(linuxのコマンド実行)

C:\WINDOWS\system32>docker run -it ubuntu bash
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
b6f892c0043b: Pull complete
55010f332b04: Pull complete
2955fb827c94: Pull complete
3deef3fcbd30: Pull complete
cf9722e506aa: Pull complete
Digest: sha256:382452f82a8bbd34443b2c727650af46aced0f94a44463c62a9848133ecb1aa8
Status: Downloaded newer image for ubuntu:latest
root@38fef27ffa98:/# pwd
/
root@38fef27ffa98:/# ls -la
total 72
drwxr-xr-x   1 root root 4096 May 25 13:44 .
drwxr-xr-x   1 root root 4096 May 25 13:44 ..
-rwxr-xr-x   1 root root    0 May 25 13:44 .dockerenv
drwxr-xr-x   2 root root 4096 May 10 16:23 bin
drwxr-xr-x   2 root root 4096 Apr 12  2016 boot
drwxr-xr-x   5 root root  360 May 25 13:44 dev
drwxr-xr-x   1 root root 4096 May 25 13:44 etc
drwxr-xr-x   2 root root 4096 Apr 12  2016 home
drwxr-xr-x   8 root root 4096 Sep 13  2015 lib
drwxr-xr-x   2 root root 4096 May 10 16:23 lib64
drwxr-xr-x   2 root root 4096 May 10 16:23 media
drwxr-xr-x   2 root root 4096 May 10 16:23 mnt
drwxr-xr-x   2 root root 4096 May 10 16:23 opt
dr-xr-xr-x 121 root root    0 May 25 13:44 proc
drwx------   2 root root 4096 May 10 16:23 root
drwxr-xr-x   1 root root 4096 May 15 16:43 run
drwxr-xr-x   1 root root 4096 May 15 16:43 sbin
drwxr-xr-x   2 root root 4096 May 10 16:23 srv
dr-xr-xr-x  13 root root    0 May 25 13:44 sys
drwxrwxrwt   2 root root 4096 May 10 16:23 tmp
drwxr-xr-x   1 root root 4096 May 15 16:43 usr
drwxr-xr-x   1 root root 4096 May 15 16:43 var
root@38fef27ffa98:/# exit
exit

 ⇒★コマンド入力可能状態。そして、root@38fef27ffa98は入力待ち受け状態。
  そこで、pwd、ls -laのコマンドを実行。


●イメージ、タスクの状況

C:\WINDOWS\system32>docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS                      PORTS               NAMES
38fef27ffa98        ubuntu              "bash"              About a minute ago   Exited (0) 23 seconds ago                       awesome_volhard
ed1c96abcbc3        hello-world         "/hello"            3 minutes ago        Exited (0) 3 minutes ago                        condescending_murdock

C:\WINDOWS\system32>docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
ubuntu              latest              ebcd9d4fca80        9 days ago          118 MB
hello-world         latest              48b5124b2768        4 months ago        1.84 kB



●再度、msのサーバーをダウンロードも兼ねて、実行。

C:\WINDOWS\system32>docker run -it microsoft/nanoserver
Unable to find image 'microsoft/nanoserver:latest' locally
latest: Pulling from microsoft/nanoserver
bce2fbc256ea: Pulling fs layer
4a8c367fd46d: Downloading
docker: unknown blob.


●microsoft/nanoserver のコマンド実行中(PowerShell)

Windows PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.

PS C:\> dir


    Directory: C:\


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----        5/25/2017  11:05 PM                Program Files
d-----        7/16/2016   9:09 PM                Program Files (x86)
d-r---         5/3/2017   1:29 AM                Users
d-----        5/25/2017  11:06 PM                Windows
-a----       11/20/2016   8:32 PM           1894 License.txt


PS C:\> cd '.\Program Files (x86)'
PS C:\Program Files (x86)> dir


    Directory: C:\Program Files (x86)


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----        7/16/2016   9:09 PM                Common Files


PS C:\Program Files (x86)> cd ..\
PS C:\> cd '.\Program Files'
PS C:\Program Files> dir


    Directory: C:\Program Files


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

C:\>powershell.exe Add-Content C:\helloworld.ps1 'Write-Host "Hello World"'

C:\>dir c:
 Volume in drive C has no label.
 Volume Serial Number is 4240-0353

 Directory of C:\

05/25/2017  11:39 PM                24 helloworld.ps1
11/20/2016  08:32 PM             1,894 License.txt
05/25/2017  11:39 PM    <DIR>          Program Files
07/16/2016  09:09 PM    <DIR>          Program Files (x86)
05/03/2017  01:29 AM    <DIR>          Users
05/25/2017  11:39 PM    <DIR>          Windows
               2 File(s)          1,918 bytes
               4 Dir(s)  21,191,225,344 bytes free

C:\>exit


 ⇒★終了

Dockerについて パート001

職場でdockerを使うようになったので、自分でも勉強と思い、
新しく買ったノートPCに
「Docker CE for Windows」
をインストールしてみました。
また、新しい?dockerだと、windows10であればHyper-Vで、できるという事なので、
ほかの仮想を入れずに、やってみました。

特にインストールや設定などは何も考えなくても、すぐに簡単にできました。
コマンドを使ってちょろっと試してみました。


ある日、急にエラーが出るようになりました。
(実際は急じゃないのでしょうが。)


[14:33:29.963][NamedPipeServer][Error ] Unable to execute Start: Unable to create: ユーザー設定変数 "ErrorActionPreference" または共通パラメーターが Stop に設定されているため、実行中のコマンドが停止しました。コンピューター 'xxxxxxxxxxxx' を解決できませんでした。マシン名を正しく入力したことと、ネットワークにアクセスできることを確認してください。
New-MobyLinuxVM、<ファイルなし>: 行 218
、<ファイルなし>: 行 381 場所 Docker.Backend.HyperV.RunScript(String action, Dictionary`2 parameters)
場所 Docker.Backend.ContainerEngine.Linux.Start(Settings settings)
場所 Docker.Core.Pipe.NamedPipeServer.<>c__DisplayClass8_0.b__0(Object[] parameters)
場所 Docker.Core.Pipe.NamedPipeServer.RunAction(String action, Object[] parameters)


何をしたらいいか、まったくわからず。
グーグル先生に聞いても、わからず。(結果は自分が理解できなかっただけだけど。)


そして、やっと気が付きました。
ええ、そうです。
vmがなくなっていました。

何をやって、無くなってしまったのか、不明です。
ちょうど、Hyper-Vを使って、ほかのlinuxの勉強をやった時に、動かしたのか、消したのか
そんなところだろうと思いますが。


ちゅうわけで、復活の方法。

Windows PowerShell を管理者で開いて。

cd "C:\Program Files\Docker\Docker\resources"

'ないけど念のため
.\MobyLinux.ps1 -destroy

.\MobyLinux.ps1 -create



そして、同じエラー。

Get-VMHost : コンピューター '**********' を解決できませんでした。マシン名を正しく入力
クセスできることを確認してください。
発生場所 C:\Program Files\Docker\Docker\resources\MobyLinux.ps1:93 文字:20
+ $VhdRoot = "$((Get-VMHost).VirtualHardDiskPath)".TrimEnd("\")
+ ~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-VMHost], VirtualizationException
+ FullyQualifiedErrorId : Unspecified,Microsoft.HyperV.PowerShell.Commands.GetVMHost


うー、なぜだ。

対象のフォルダを見てみる。
C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\

ん?なんか聞いてきた。


もう一回やってみる。


PS C:\Program Files\Docker\Docker\resources> .\MobyLinux.ps1 -create
Script started at 15:44:34.216
Module loaded at 15:44:34.247
Using existing Switch: DockerNAT
Using existing Switch IP address
Setting CPUs to 2 and Memory to 2048 MB
Creating dynamic VHD: C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\MobyLinuxVM.vhdx
Attach VHD C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\MobyLinuxVM.vhdx
Connect Internal Switch DockerNAT
Attach DVD .\mobylinux.iso
Disabled ゲスト サービス インターフェイス
Enabled ハートビート
Disabled キー値ペア交換
Enabled シャットダウン
Enabled 時刻の同期
Disabled VSS
VM created.


あ、いけた。
フォルダーへのアクセス許可?

Hyper-Vで、確認すると、仮想マシンができていました。
そして、仮想ハードディスクも出来ていました。


デスクトップにある「Docker for Windows」アイコンをダブルクリックし、
正常に起動し、Hyper-Vでも、実行中になりました。


なんとか、復活できたようでよかった。

Nexus 7 (2013)について パート2

車のナビが古いので、最近ではナビ代わりに使用しているわけですが、

それ以外にも時々使用します。

 

そうすると、記憶用容量が少ないためか、動作が重い。

重い。

そのため、だんだんと使用しなくなっていたのです。

 

その時のandroidのバージョンは4.4.4。

 

どうせ、使用しなくなるのであれば、もったいないな、という事で、

androidのバージョンをあげることにしました。

 

まずは、5.0.1。

 

更新後、動作がめっちゃ早くなりました。

 

こんな事なら、早くやっておけばよかった。

 

そして、今では6.0.1に更新しています。

 

今のところ、特に使用できないアプリはなさそう。

といっても、タブで使用しているのは3,4ぐらいですが。

 

 

 

Visual Studio 2017について パート1

待ちに待った、Visual Studio 2017が出ました。

(現時点ではちょっと(1カ月)前になりますが。)

 

そして、ノートPCにインストールしましたよ。

480GBのSSDを積んでいるとはいえ、すでに100GBを切っているのでドキドキです。

OFFLINEのISOを探したのですが、ありませんでした。

 

なので、WEB(?)インストーラーをダウンロードして、MSプロンプト上で

引数を指定して実行しないといけないです。

 

https://docs.microsoft.com/ja-jp/visualstudio/install/create-an-offline-installation-of-visual-studio

 

RCですが、まあ、これを参考にしたらできましたよ。

どうやら、準備中らしいですね。 

 

で、ダウンロードしたら、23GBでした。

使いすぎ。。。

 

うーん、DVDも焼けない。

 

ブルレイですか?

 

実際はISOファイルじゃないようなので、準備できたら、

DVDなんか、知らね、なんでしょうか。

そうか、ミニマムを作るのか。。。

 

DVD8枚組?

それとも、ブルレイのみか。

 

 

ま、いいや。

 

未だに、WEBインストールが嫌いな私です。

 

 

CentOSについて パート1

仕事でLinuxを使うようになったので、勉強しようと思い、

ノートPCのWindows10のhyper-v上で立ち上げてみました。

 

仮想マシンを作成する際に世代を選択できるので、

64bitのUFEIがいいなという事で、2世代を選択しました。

 

いざ、インストールというところでエラーになります。

リセットして、何回もやり直してもエラーになります。

 

ぐぐりました。

 

すぐに答えが出てきました。

 

https://social.technet.microsoft.com/Forums/windows/en-US/fbed0fe1-daa8-40e1-8d5c-3c63957d59ad/win-10-hyperv-guest-gen2-wont-install-os-from-iso-using-virtual-hard-disk?forum=win10itprovirt

 

ありがとうございます。

投稿者&回答者の方々。

 

ええ、セキュアブートをOFFにしたら、エラーしなくなりました。

 

仮想マシン作成中に、見つからなかったので、

作成後に設定画面を開けて、ハードウエアのセキュリティータブ(?)から

設定できました。

 

場合によっては、はまりそうだったけど、

今回はスムーズに行けました。

はい。

 

あと、これ。

https://technet.microsoft.com/windows-server-docs/compute/hyper-v/plan/should-i-create-a-generation-1-or-2-virtual-machine-in-hyper-v

 

 

以上。

 

 

 

 

あけましておめでとうございます。2017

まさかの、今年5日目にしての投稿。

 

去年、一年間お世話になりました。

(2投稿しかしてないけど。)

 

去年は仕事でphpを使うようになったり、

apacheのコマンドに苦労したり。。。

 

そして、年末はスマホの新しいサービスを始めたり。

マリオランをミーハーでやってみたり。

 

そんなわけで、今年もよろしくお願いします。

(何通、投稿するかわからないけど。)

 

 

おやじぎゃぐ パート3 カッパドキア

(2006-06-18 21:15:24)


カッパ、どきや。

トルコにある都市だそうです。

あけましておめでとうございます。2016

とうとう、9月での一発目の投稿。

むむむ。

 

まあ、ずっと忙しかったのでしょうがなかったと言えば、しょうがなかったのですが。。。

 

軽く、今年も後半戦突入していますね。

 

暑い夏もようやく、終わりに差し掛かってきました。

 

暑い。

 

家の畳が熱い。

 

ちゅうわけで、一発目恒例の投稿でした。

 

明日からがんばるか。(たぶん)

 

 

そう思うと、毎日投稿している人って尊敬します。

 

デジカメについて パート3

というわけで、そうそうに新しいデジカメを買いました。

はい、FinePix F80EXR(富士フイルム)です。


これがまた、F70EXRの備品が使えます。

とりあえず、よかった。

結構、揃えるのってお金かかるので。


電池もやっぱし、予備とかいるし、充電器もそう。

ちゅうわけで、これを今でも使っています。

デジカメについて パート2

どうやら、これについても、昔に少し、語っておりまして。。。。

デジカメ

で、


初代が、F1500、2代目がF420なのですが、


次はFinePix F70EXRです。

あ、最初から富士フイルムです。

気に入ってたのですが、ショットしたアクシデントで壊してしまいました。

レンズが出てこなくなったので、早々に次を買いました。

ほんとは、修理したほうがいいかなと、思ったのですが、

思った以上に、高くつくようなので、購入する事を決めました。

しかし、とりあえず、サランラップ巻いて、置いてます。

そのうち、修理できることを祈りつつ。(その頃には修理不可能になってるか。。。)