「Docker コマンド」の版間の差分
ナビゲーションに移動
検索に移動
1行目: | 1行目: | ||
− | ==Docker コマンド== | + | ==[[Docker コマンド]]== |
[[Docker]] | [[仮想化]] | | [[Docker]] | [[仮想化]] | | ||
10行目: | 10行目: | ||
Client API version: 1.12 | Client API version: 1.12 | ||
Go version (client): go1.2.2 | Go version (client): go1.2.2 | ||
− | Git commit (client): 63fe64c/1.0.0 | + | [[Git]] commit (client): 63fe64c/1.0.0 |
Server version: 1.0.0 | Server version: 1.0.0 | ||
Server API version: 1.12 | Server API version: 1.12 | ||
Go version (server): go1.2.2 | Go version (server): go1.2.2 | ||
− | Git commit (server): 63fe64c/1.0.0 | + | [[Git]] commit (server): 63fe64c/1.0.0 |
===情報の確認(info)=== | ===情報の確認(info)=== | ||
# docker info | # docker info | ||
Containers: 1 | Containers: 1 | ||
Images: 3 | Images: 3 | ||
− | Storage Driver: | + | Storage Driver: de[[vi]]cemapper |
Pool Name: docker-253:1-203234686-pool | Pool Name: docker-253:1-203234686-pool | ||
− | Data file: /var/lib/docker/ | + | Data file: /var/lib/docker/de[[vi]]cemapper/de[[vi]]cemapper/data |
− | Metadata file: /var/lib/docker/ | + | Metadata file: /var/lib/docker/de[[vi]]cemapper/de[[vi]]cemapper/metadata |
Data Space Used: 569.2 Mb | Data Space Used: 569.2 Mb | ||
Data Space Total: 102400.0 Mb | Data Space Total: 102400.0 Mb | ||
30行目: | 30行目: | ||
Kernel Version: 3.10.0-123.el7.x86_64 | Kernel Version: 3.10.0-123.el7.x86_64 | ||
===イメージの取得=== | ===イメージの取得=== | ||
− | ====Docker Registry==== | + | ====[[Docker]] Registry==== |
*https://registry.hub.docker.com/ | *https://registry.hub.docker.com/ | ||
===取得(pull)=== | ===取得(pull)=== | ||
43行目: | 43行目: | ||
===確認(images)=== | ===確認(images)=== | ||
# docker images | # docker images | ||
− | + | [[R]]EPOSITO[[R]]Y TAG IMAGE ID C[[R]]EATED VI[[R]]TUAL SIZE | |
openshift/wildfly-8-centos latest f3ba582d4042 6 days ago 539.3 MB | openshift/wildfly-8-centos latest f3ba582d4042 6 days ago 539.3 MB | ||
centos latest 1a7dc42f78ba 8 days ago 236.4 MB | centos latest 1a7dc42f78ba 8 days ago 236.4 MB | ||
58行目: | 58行目: | ||
====プロセスの確認(ps)==== | ====プロセスの確認(ps)==== | ||
# docker ps | # docker ps | ||
− | CONTAINER ID IMAGE | + | CONTAINER ID IMAGE [[COM]]MAND CREATED STATUS PORTS NAMES |
564e5343046f openshift/wildfly-8-centos:latest /wildfly/bin/standal About a minute ago Up About a minute 7600/tcp, 8080/tcp, 9990/tcp, 9999/tcp insane_euclid | 564e5343046f openshift/wildfly-8-centos:latest /wildfly/bin/standal About a minute ago Up About a minute 7600/tcp, 8080/tcp, 9990/tcp, 9999/tcp insane_euclid | ||
====プロセス監視(top)==== | ====プロセス監視(top)==== | ||
77行目: | 77行目: | ||
====イメージの削除(rmi)==== | ====イメージの削除(rmi)==== | ||
# docker images | # docker images | ||
− | + | [[R]]EPOSITO[[R]]Y TAG IMAGE ID C[[R]]EATED VI[[R]]TUAL SIZE | |
openshift/wildfly-8-centos latest f3ba582d4042 3 weeks ago 539.3 MB | openshift/wildfly-8-centos latest f3ba582d4042 3 weeks ago 539.3 MB | ||
<none> <none> 1a7dc42f78ba 3 weeks ago 236.4 MB | <none> <none> 1a7dc42f78ba 3 weeks ago 236.4 MB | ||
100行目: | 100行目: | ||
"HOME=/", | "HOME=/", | ||
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", | "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", | ||
− | " | + | "STI_SC[[R]]IPTS_U[[R]]L=https://raw.githubusercontent.com/openshift/wildfly-8-centos/master/.sti/bin" |
], | ], | ||
"ExposedPorts": { | "ExposedPorts": { | ||
123行目: | 123行目: | ||
}, | }, | ||
"Created": "2014-08-03T14:37:58.975398521Z", | "Created": "2014-08-03T14:37:58.975398521Z", | ||
− | "Driver": " | + | "Driver": "de[[vi]]cemapper", |
"ExecDriver": "native-0.2", | "ExecDriver": "native-0.2", | ||
"HostConfig": { | "HostConfig": { | ||
139行目: | 139行目: | ||
"9999/tcp": null | "9999/tcp": null | ||
}, | }, | ||
− | " | + | "Pri[[vi]]leged": false, |
"PublishAllPorts": false, | "PublishAllPorts": false, | ||
"VolumesFrom": null | "VolumesFrom": null | ||
147行目: | 147行目: | ||
"Id": "faff5b7c749257ff79180b5c9b90e3cadabec91a76895c086ec4e66fd84b3733", | "Id": "faff5b7c749257ff79180b5c9b90e3cadabec91a76895c086ec4e66fd84b3733", | ||
"Image": "f3ba582d4042e5e506e787e102bd122617cf4d574a32ff75ec5c5606aa60c4f0", | "Image": "f3ba582d4042e5e506e787e102bd122617cf4d574a32ff75ec5c5606aa60c4f0", | ||
− | "MountLabel": "system_u:object_r: | + | "MountLabel": "system_u:object_r:s[[vi]]rt_sandbox_file_t:s0:c219,c329", |
"Name": "/compassionate_babbage", | "Name": "/compassionate_babbage", | ||
"NetworkSettings": { | "NetworkSettings": { | ||
163行目: | 163行目: | ||
}, | }, | ||
"Path": "/wildfly/bin/standalone.sh", | "Path": "/wildfly/bin/standalone.sh", | ||
− | "ProcessLabel": "system_u:system_r: | + | "ProcessLabel": "system_u:system_r:s[[vi]]rt_lxc_net_t:s0:c219,c329", |
− | " | + | "[[R]]esolvConfPath": "/etc/resolv.conf", |
"State": { | "State": { | ||
"ExitCode": 0, | "ExitCode": 0, | ||
170行目: | 170行目: | ||
"Paused": false, | "Paused": false, | ||
"Pid": 3503, | "Pid": 3503, | ||
− | " | + | "[[R]]unning": true, |
"StartedAt": "2014-08-19T14:00:08.994894748Z" | "StartedAt": "2014-08-19T14:00:08.994894748Z" | ||
}, | }, | ||
"Volumes": {}, | "Volumes": {}, | ||
− | " | + | "Volumes[[R]]W": {} |
} | } | ||
] | ] |
2020年2月16日 (日) 04:24時点における版
目次
Docker コマンド
バージョンの確認(version)
# docker version Client version: 1.0.0 Client API version: 1.12 Go version (client): go1.2.2 Git commit (client): 63fe64c/1.0.0 Server version: 1.0.0 Server API version: 1.12 Go version (server): go1.2.2 Git commit (server): 63fe64c/1.0.0
情報の確認(info)
# docker info Containers: 1 Images: 3 Storage Driver: devicemapper Pool Name: docker-253:1-203234686-pool Data file: /var/lib/docker/devicemapper/devicemapper/data Metadata file: /var/lib/docker/devicemapper/devicemapper/metadata Data Space Used: 569.2 Mb Data Space Total: 102400.0 Mb Metadata Space Used: 0.9 Mb Metadata Space Total: 2048.0 Mb Execution Driver: native-0.2 Kernel Version: 3.10.0-123.el7.x86_64
イメージの取得
Docker Registry
取得(pull)
# docker pull openshift/wildfly-8-centos Pulling repository openshift/wildfly-8-centos f3ba582d4042: Download complete f3ba582d4042: Pulling image (latest) from openshift/wildfly-8-centos 511136ea3c5a: Download complete : 7e1fd6711692: Download complete 6244d7d2948c: Download complete
確認(images)
# docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE openshift/wildfly-8-centos latest f3ba582d4042 6 days ago 539.3 MB centos latest 1a7dc42f78ba 8 days ago 236.4 MB
実行
インタラクティブ実行(run –t)
- run –t でインタラクティブにシェルを実行出来る
- 任意のコマンドをコンテナ内で実行可能
- 停止する場合は、Ctrl+D
# docker run -i -t -h openshift/wildfly-8-centos openshift/wildfly-8-centos /bin/bash bash-4.1#
バックグラウンド実行(run –d)
# docker run -d openshift/wildfly-8-centos /wildfly/bin/standalone.sh 564e5343046f97da12ba09273020eabbb7a84d4b0299f13c256b43aa449d1bb7
プロセスの確認(ps)
# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 564e5343046f openshift/wildfly-8-centos:latest /wildfly/bin/standal About a minute ago Up About a minute 7600/tcp, 8080/tcp, 9990/tcp, 9999/tcp insane_euclid
プロセス監視(top)
# docker top 564e5343046f UID PID PPID C STIME TTY TIME CMD root 5739 1401 0 23:22 ? 00:00:00 /bin/sh /wildfly/bin/standalone.sh root 5867 5739 14 23:22 ? 00:00:07 java -D[Standalone] -server -XX:+UseSerialGC -Xms40m -Xmx256m -XX:MaxPermSize=102m -XX:+AggressiveOpts -Dorg.apache.tomcat.util.LOW_MEMORY=true -DOPENSHIFT_APP_UUID= -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Dorg.jboss.resolver.warning=true -Djava.net.preferIPv4Stack=true -Dfile.encoding=UTF-8 -Djboss.node.name=564e5343046f -Djgroups.bind_addr=0.0.0.0 -Dorg.apache.coyote.http11.Http11Protocol.COMPRESSION=on -Dorg.jboss.boot.log.file=/wildfly/standalone/log/server.log -Dlogging.configuration=file:/wildfly/standalone/configuration/logging.properties -jar /wildfly/jboss-modules.jar -mp /wildfly/provided_m
コンテナの停止(stop)
# docker stop 564e5343046f 564e5343046f
コンテナの強制終了(kill)
# docker kill faff5b7c7492 faff5b7c7492
コンテナの再起動(restart)
# docker restart 564e5343046f 564e5343046f
イメージの管理
イメージの削除(rmi)
# docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE openshift/wildfly-8-centos latest f3ba582d4042 3 weeks ago 539.3 MB <none> <none> 1a7dc42f78ba 3 weeks ago 236.4 MB # docker rmi -f 1a7dc42f78ba Deleted: 1a7dc42f78ba213ec1ac5cd04930011334536214ad26c8000f1eec72e302c041
コンテナ状態の確認(inspect)
# docker inspect faff5b7c7492 [{ "Args": [], "Config": { "AttachStderr": false, "AttachStdin": false, "AttachStdout": false, "Cmd": [ "/wildfly/bin/standalone.sh" ], "CpuShares": 0, "Cpuset": "", "Domainname": "", "Entrypoint": null, "Env": [ "HOME=/", "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "STI_SCRIPTS_URL=https://raw.githubusercontent.com/openshift/wildfly-8-centos/master/.sti/bin" ], "ExposedPorts": { "7600/tcp": {}, "8080/tcp": {}, "9990/tcp": {}, "9999/tcp": {} }, "Hostname": "faff5b7c7492", "Image": "openshift/wildfly-8-centos", "Memory": 0, "MemorySwap": 0, "NetworkDisabled": false, "OnBuild": null, "OpenStdin": false, "PortSpecs": null, "StdinOnce": false, "Tty": false, "User": "", "Volumes": null, "WorkingDir": "/opt/wildfly/source" }, "Created": "2014-08-03T14:37:58.975398521Z", "Driver": "devicemapper", "ExecDriver": "native-0.2", "HostConfig": { "Binds": null, "ContainerIDFile": "", "Dns": null, "DnsSearch": null, "Links": null, "LxcConf": [], "NetworkMode": "bridge", "PortBindings": { "7600/tcp": null, "8080/tcp": null, "9990/tcp": null, "9999/tcp": null }, "Privileged": false, "PublishAllPorts": false, "VolumesFrom": null }, "HostnamePath": "/var/lib/docker/containers/faff5b7c749257ff79180b5c9b90e3cadabec91a76895c086ec4e66fd84b3733/hostname", "HostsPath": "/var/lib/docker/containers/faff5b7c749257ff79180b5c9b90e3cadabec91a76895c086ec4e66fd84b3733/hosts", "Id": "faff5b7c749257ff79180b5c9b90e3cadabec91a76895c086ec4e66fd84b3733", "Image": "f3ba582d4042e5e506e787e102bd122617cf4d574a32ff75ec5c5606aa60c4f0", "MountLabel": "system_u:object_r:svirt_sandbox_file_t:s0:c219,c329", "Name": "/compassionate_babbage", "NetworkSettings": { "Bridge": "docker0", "Gateway": "172.17.42.1", "IPAddress": "172.17.0.3", "IPPrefixLen": 16, "PortMapping": null, "Ports": { "7600/tcp": null, "8080/tcp": null, "9990/tcp": null, "9999/tcp": null } }, "Path": "/wildfly/bin/standalone.sh", "ProcessLabel": "system_u:system_r:svirt_lxc_net_t:s0:c219,c329", "ResolvConfPath": "/etc/resolv.conf", "State": { "ExitCode": 0, "FinishedAt": "2014-08-19T13:58:30.659032186Z", "Paused": false, "Pid": 3503, "Running": true, "StartedAt": "2014-08-19T14:00:08.994894748Z" }, "Volumes": {}, "VolumesRW": {} } ]
© 2006 矢木浩人