機能・要件 
 構成・方式 
 タスク 
    コマンド
    コンテナ生成
    コンテナ開始
    ポート確認
    イメージ検索
    イメージ一覧
    イメージ入手
    イメージ保存
    イメージ作成
    DockerFile
    Compose
    httpd
    centos
    hello-world
    サービス状態
 導入 
 ToolBox導入 

 コマンド
        コマンドIndex  man  docker  コンテナ操作  run
 inspect  ps  start他  port  exec
 attach  logs  rm  イメージ操作  images
 pull  search  commit  rmi  push
 イメージ作成  build  ネットワーク    

 DockerFile
 ・DockerFileDockerFileの仕様DockerFile内の命令などの形式
 ・記述例
httpd

 DockerCompose
 ・DockerToolboxDockerMachineインストールした場合、
  同時に DockerCompose もインストールされる。
$ docker-compose --version
docker-compose version 1.24.1, build xxxx

 httpd
 ・ApacheのWebサーバイメージhttpdを、コンテナとして起動
$ docker run --name web1 -d -p 8080:80 httpd
バックグラウンドで実行
ホストマシンの8080番ポートをコンテナの80番ポートにマッピング
ローカルホストにイメージが無く、DockerHubからイメージをダウンロード
ブラウザでホストマシンにポート番号8080を指定してアクセス

 centos  (The official build of CentOS.)
 ・対話型インタフェースを持つプログラムをフォアグラウンドで起動
 ※rootユーザーがコンソールでログイン中は、プログラムを動かせる。
$ docker search centos
$ docker pull centos
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest feb5d9fea6a5 2 months ago 13.3kB
centos latest 5d0da3dc9764 3 months ago 231MB
 ・CentOS7のサーバイメージcentosを、コンテナとして起動
$ docker run -it --name CentOS centos:latest /bin/bash
※/bin/bash :コンテナで実行するコマンド
疑似端末を有効にし、標準入力をオープンしたままにする。
コンテナ名は、CentOS7
起動すると、コンソールに接続され、シェルのプロンプト
「Ctrl+p」+「Ctrl+q」で、コンテナを終了させずに、ホストのプロンプトに戻る。
もう一度接続するには、docker attachコマンドを使用($ docker attach CentOS7)
「Ctrl+d」でコンテナが終了
@1aeafbef2493 /]#   (bashの新しいプロンプト)
@1aeafbef2493 /]# uname -r
3.10.0-1160.49.1.el7.x86_64
@1aeafbef2493 /]# ps -ax  (コンテナー実行環境などのプロセスは隠ぺい)
PID TTY STAT TIME COMMAND
1 pts/0 Ss 0:00 /bin/bash  (プロセスID:1 で動いている。)
16 pts/0 R+ 0:00 ps -ax
@1aeafbef2493 /]# exit
#   (コンテナの実行は終了)
# docker run -it centos:latest /bin/bash  (同じコマンドで、新しいコンテナを作成)
@10f46d6be7d4 /]#
# docker ps -a  (別の端末から確認、停止中のコンテナーも表示)    CONTAINER ID IMAGE COMMAND CREATED STATUS ・・・    10f46d6be7d4 centos:latest "/bin/bash" 12 minutes ago Up 12 minutes    1aeafbef2493 centos:latest "/bin/bash" 59 minutes ago Exited (0) 51 minutes ago    425059dff821 hello-world "/hello" 4 hours ago Exited (0) 4 hours ago # docker rm 1aeafbef2493  (コンテナーを削除)
 hello-world  
 ・公式のhello-worldコンテナのイメージを取得し、コンテナを実行
# docker run hello-world
 ・イメージにはCで書かれた説明用文字を表示するバイナリが入っている。
表示の上の5行は、初めてイメージを取得する場合に表示されるメッセージ
 ・ローカルに hello-world:latest が存在しないため DockerHub からイメージを取得
$ docker images  イメージ情報
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest feb5d9fea6a5 2 months ago 13.3kB
 ・イメージの詳細情報
$ docker inspect hello-world:latest

 イメージを検索
$ docker search centos
        NAME  DESCRIPTION (STARS、OFFICIAL、AUTOMATED)
 centos The official build of CentOS.
 ansible/centos7-ansible Ansible on Centos7
 consol/centos-xfce-vnc Centos container with "headless" VNC session…
 jdeathe/centos-ssh OpenSSH / Supervisor / EPEL/IUS/SCL Repos - …
 centos/systemd systemd enabled base container.
 imagine10255/centos6-lnmp-php56 centos6-lnmp-php56
 tutum/centos Simple CentOS docker image with SSH access
 centos/httpd-24-centos7 Platform for running Apache httpd 2.4 or bui…
 jdeathe/centos-ssh-apache-php Apache PHP - CentOS.
 kinogmt/centos-ssh CentOS with SSH
 guyton/centos6 From official centos6 container with full up…
 nathonfowlie/centos-jre Latest CentOS image with the JRE pre-install…
 centos/tools Docker image that has systems administration…
 drecom/centos-ruby centos ruby
 roboxes/centos8 A generic CentOS 8 base image.
 mamohr/centos-java Oracle Java 8 Docker image based on Centos 7
 darksheer/centos Base Centos Image -- Updated hourly
 dokken/centos-7 CentOS 7 image for kitchen-dokken
 amd64/centos The official build of CentOS.
 ovirtguestagent/centos7-atomic The oVirt Guest Agent for Centos 7 Atomic Ho……
 blacklabelops/centos CentOS Base Image! Built and Updates Daily!
 mcnaughton/centos-base centos base image
 myheritage/centos7-git-java CentOs based docker image for Jenkins slave
 smartentry/centos centos with smartentry
 starlabio/centos-native-build Our CentOS image for native builds

 サービスの状態を確認
$ docker info    Client:     Context: default     Debug Mode: false     Plugins:     app: Docker App (Docker Inc., v0.9.1-beta3)     buildx: Docker Buildx (Docker Inc., v0.7.1-docker)     scan: Docker Scan (Docker Inc., v0.12.0)    Server:     Containers: 2     Running: 0     Paused: 0     Stopped: 2     Images: 1     Server Version: 20.10.12     Storage Driver: overlay2     Backing Filesystem: xfs     Supports d_type: true     Native Overlay Diff: true     userxattr: false     Logging Driver: json-file     Cgroup Driver: cgroupfs     Cgroup Version: 1     Plugins:     Volume: local     Network: bridge host ipvlan macvlan null overlay     Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog     Swarm: inactive     Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc     Default Runtime: runc     Init Binary: docker-init     containerd version: 7b11cfaabd73bb80907dd23182b9347b4245eb5d     runc version: v1.0.2-0-g52b36a2     init version: de40ad0     Security Options:     seccomp     Profile: default     Kernel Version: 3.10.0-1160.49.1.el7.x86_64     Operating System: CentOS Linux 7 (Core)     OSType: linux     Architecture: x86_64     CPUs: 1     Total Memory: 3.607GiB     Name: kvmxx.localdomain     ID: NPRN:UCAC:5TW7:3K4E:X7QT:BF3E:ZIMS:FK36:TXJV:DDBM:6YN5:6HMH     Docker Root Dir: /var/lib/docker     Debug Mode: false     Registry: https://index.docker.io/v1/     Labels:     Experimental: false     Insecure Registries:     127.0.0.0/8     Live Restore Enabled: false