Centos7
[root@docker1 etc]# more system-release
CentOS Linux release 7.3.1611 (Core)
[root@docker1 etc]# uname -a
Linux docker1.f5lab.com 3.10.0-514.16.1.el7.x86_64 #1 SMP Wed Apr 12 15:04:24 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[root@docker1 etc]# docker info
Containers: 1
Running: 0
Paused: 0
Stopped: 1
Images: 1
Server Version: 17.05.0-ce
Storage Driver: overlay
Backing Filesystem: xfs
Supports d_type: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9048e5e50717ea4497b757314bad98ea3763c145
runc version: 9c2d8d184e5da67c95d601382adf14862e4f2228
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-514.16.1.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.844GiB
Name: docker1.f5lab.com
ID: 7DCC:YGQU:S2YZ:FYSL:4HMD:4GSC:5UCN:KIPQ:32QM:3TVC:YDJU:OUL6
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: overlay: the backing xfs filesystem is formatted without d_type support, which leads to incorrect behavior.
Reformat the filesystem with ftype=1 to enable d_type support.
Running without d_type support will not be supported in future releases.
刚启动docker后,/var/lib/docker下状态:
[root@docker1 docker]# tree -L 10
.
├── containers
├── image
│ └── overlay
│ ├── distribution
│ ├── imagedb
│ │ ├── content
│ │ │ └── sha256
│ │ └── metadata
│ │ └── sha256
│ ├── layerdb
│ └── repositories.json
├── network
│ └── files
│ └── local-kv.db
├── overlay
├── plugins
│ ├── storage
│ │ └── blobs
│ │ └── tmp
│ └── tmp
├── swarm
├── tmp
├── tmp-old
├── trust
└── volumes
└── metadata.db
23 directories, 3 files
[root@docker1 files]# pwd
/var/lib/docker/network/files
1 2 3 |
[root@docker1 files]# cat local-kv.db docker/network/v1.0/bridge/734c4df7548e0b27980630a0edf4eec2094bfb24c51f8b89b04c543f7fd866b0/{"AddressIPv4":"172.17.0.1/16","BridgeIfaceCreator":2,"BridgeName":"docker0","ContainerIfacePrefix":"","DefaultBindingIP":"0.0.0.0","DefaultBridge":true,"DefaultGatewayIPv4":"\u003cnil\u003e","DefaultGatewayIPv6":"\u003cnil\u003e","EnableICC":true,"EnableIPMasquerade":true,"EnableIPv6":false,"ID":"734c4df7548e0b27980630a0edf4eec2094bfb24c51f8b89b04c543f7fd866b0","Internal":false,"Mtu":1500}docker/network/v1.0/endpoint_count/docker/network/v1.0/endpoint_count/206ea33a6608a67da21e14dc769140b44353e40f735de7741cfab6bed16d7ef7/{"Count":0}docker/network/v1.0/endpoint_count/734c4df7548e0b27980630a0edf4eec2094bfb24c51f8b89b04c543f7fd866b0/{"Count":0}docker/network/v1.0/endpoint_count/e7f32fd414b942a244d345b1654d331c73564ebc4054462e5cc8c2e6d0076152/{"Count":0}docker/network/v1.0/network/206ea33a6608a67da21e14dc769140b44353e40f735de7741cfab6bed16d7ef7/{"addrSpace":"","attachable":false,"created":"2017-05-08T10:17:39.163671671+08:00","enableIPv6":false,"generic":{"com.docker.network.generic":{}},"id":"206ea33a6608a67da21e14dc769140b44353e40f735de7741cfab6bed16d7ef7","inDelete":false,"ingress":false,"internal":false,"ipamOptions":null,"ipamType":"default","labels":null,"name":"none","networkType":"null","persist":true,"postIPv6":false,"scope":"local"}docker/network/v1.0/network/734c4df7548e0b27980630a0edf4eec2094bfb24c51f8b89b04c543f7fd866b0/{"addrSpace":"LocalDefault","attachable":false,"created":"2017-05-08T11:19:43.110067372+08:00","enableIPv6":false,"generic":{"com.docker.network.enable_ipv6":false,"com.docker.network.generic":{"com.docker.network.bridge.default_bridge":"true","com.docker.network.bridge.enable_icc":"true","com.docker.network.bridge.enable_ip_masquerade":"true","com.docker.network.bridge.host_binding_ipv4":"0.0.0.0","com.docker.network.bridge.name":"docker0","com.docker.network.driver.mtu":"1500"}},"id":"734c4df7548e0b27980630a0edf4eec2094bfb24c51f8b89b04c543f7fd866b0","inDelete":false,"ingress":false,"internal":false,"ipamOptions":null,"ipamType":"default","ipamV4Config":"[{\"PreferredPool\":\"172.17.0.0/16\",\"SubPool\":\"\",\"Gateway\":\"172.17.0.1\",\"AuxAddresses\":{}}]","ipamV4Info":"[{\"IPAMData\":\"{\\\"AddressSpace\\\":\\\"LocalDefault\\\",\\\"AuxAddresses\\\":{},\\\"Gateway\\\":\\\"172.17.0.1/16\\\",\\\"Pool\\\":\\\"172.17.0.0/16\\\"}\",\"PoolID\":\"LocalDefault/172.17.0.0/16\"}]","labels":null,"name":"bridge","networkType":"bridge","persist":true,"postIPv6":false,"scope":"local"}docker/network/v1.0/network/e7f32fd414b942a244d345b1654d331c73564ebc4054462e5cc8c2e6d0076152/{"addrSpace":"","attachable":false,"created":"2017-05-08T10:17:39.166053692+08:00","enableIPv6":false,"generic":{"com.docker.network.generic":{}},"id":"e7f32fd414b942a244d345b1654d331c73564ebc4054462e5cc8c2e6d0076152","inDelete":false,"ingress":false,"internal":false,"ipamOptions":null,"ipamType":"default","labels":null,"name":"host","networkType":"host","persist":true,"postIPv6":false,"scope":"local"} libnetworkp\ |
[root@docker1 files]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.0.1 0.0.0.0 UG 100 0 0 eno16777736
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
192.168.0.0 0.0.0.0 255.255.255.0 U 100 0 0 eno16777736
[root@docker1 files]# ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 0.0.0.0
ether 02:42:4e:be:c2:89 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.129 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::20c:29ff:fe42:d98 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:42:0d:98 txqueuelen 1000 (Ethernet)
RX packets 3444 bytes 467959 (456.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1817 bytes 600598 (586.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eno33554960: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 00:0c:29:42:0d:a2 txqueuelen 1000 (Ethernet)
RX packets 7 bytes 1140 (1.1 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eno50332184: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 00:0c:29:42:0d:ac txqueuelen 1000 (Ethernet)
RX packets 7 bytes 1140 (1.1 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 68 bytes 5844 (5.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 68 bytes 5844 (5.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@docker1 files]# ip netns show 为空, 实际上此时是有ns的,只是容器的ns不在该命令查找的文件夹下。方法见学习备忘2文章
[root@docker1 files]# docker network ls
NETWORK ID NAME DRIVER SCOPE
734c4df7548e bridge bridge local
e7f32fd414b9 host host local
206ea33a6608 none null local
[root@docker1 files]# docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@docker1 files]# docker image
image images
[root@docker1 files]# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
[root@docker1 files]# docker volume ls
DRIVER VOLUME NAME
[root@docker1 files]# docker system df
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 0 0 0B 0B
Containers 0 0 0B 0B
Local Volumes 0 0 0B 0B
[root@docker1 files]# 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/
[root@docker1 /]# docker container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
276041ef9cbe hello-world "/hello" 3 hours ago Exited (0) 3 hours ago agitated_keller
[root@docker1 files]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest 48b5124b2768 3 months ago 1.84kB
[root@docker1 files]# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest 48b5124b2768 3 months ago 1.84kB
[root@docker1 files]# docker history hello-world
IMAGE CREATED CREATED BY SIZE COMMENT
48b5124b2768 3 months ago /bin/sh -c #(nop) CMD ["/hello"] 0B
<missing> 3 months ago /bin/sh -c #(nop) COPY file:22b680a46dca70... 1.84kB
[root@docker1 files]# docker inspect hello-world
[
{
"Id": "sha256:48b5124b2768d2b917edcb640435044a97967015485e812545546cbed5cf0233",
"RepoTags": [
"hello-world:latest"
],
"RepoDigests": [
"hello-world@sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7"
],
"Parent": "",
"Comment": "",
"Created": "2017-01-13T22:50:56.415736637Z",
"Container": "d7e9f7ed9c135402fba7227d8da07c250126181eee0cfd2743b5736b80108625",
"ContainerConfig": {
"Hostname": "b3e3b3843b7f",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": [
"/bin/sh",
"-c",
"#(nop) ",
"CMD [\"/hello\"]"
],
"Image": "sha256:fba45bbdabc1ff498b7965f99d2f25c59266cfa751067951f8e965841928c843",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {}
},
"DockerVersion": "1.12.3",
"Author": "",
"Config": {
"Hostname": "b3e3b3843b7f",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": [
"/hello"
],
"Image": "sha256:fba45bbdabc1ff498b7965f99d2f25c59266cfa751067951f8e965841928c843",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {}
},
"Architecture": "amd64",
"Os": "linux",
"Size": 1840,
"VirtualSize": 1840,
"GraphDriver": {
"Data": {
"RootDir": "/var/lib/docker/overlay/4ff8b86a0317b5a6bd539e51ec676395e6079f4d8a77b34ff95cb8a9451279a0/root"
},
"Name": "overlay"
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:98c944e98de8d35097100ff70a31083ec57704be0991a92c51700465e4544d08"
]
}
}
]
run一个镜像之后:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
[root@docker1 docker]# tree -L 10 . ├── containers │ └── 276041ef9cbefee243480ed52e5d2e0529df7a7c6c6a617f38ab6937136079f3 │ ├── 276041ef9cbefee243480ed52e5d2e0529df7a7c6c6a617f38ab6937136079f3-json.log │ ├── checkpoints │ ├── config.v2.json │ ├── hostconfig.json │ ├── hostname │ ├── hosts │ ├── resolv.conf │ ├── resolv.conf.hash │ └── shm ├── image │ └── overlay │ ├── distribution │ │ ├── diffid-by-digest │ │ │ └── sha256 │ │ │ └── 78445dd45222097f5f8d5a16e48dc19c4ca162dcdb80010ab6f1ccfc7e2c0fa3 │ │ └── v2metadata-by-diffid │ │ └── sha256 │ │ └── 98c944e98de8d35097100ff70a31083ec57704be0991a92c51700465e4544d08 │ ├── imagedb │ │ ├── content │ │ │ └── sha256 │ │ │ └── 48b5124b2768d2b917edcb640435044a97967015485e812545546cbed5cf0233 │ │ └── metadata │ │ └── sha256 │ ├── layerdb │ │ ├── mounts │ │ │ └── 276041ef9cbefee243480ed52e5d2e0529df7a7c6c6a617f38ab6937136079f3 │ │ │ ├── init-id │ │ │ ├── mount-id │ │ │ └── parent │ │ ├── sha256 │ │ │ └── 98c944e98de8d35097100ff70a31083ec57704be0991a92c51700465e4544d08 │ │ │ ├── cache-id │ │ │ ├── diff │ │ │ ├── size │ │ │ └── tar-split.json.gz │ │ └── tmp │ └── repositories.json ├── network │ └── files │ └── local-kv.db ├── overlay │ ├── 14d4a3283bd0fac4850cf1151a5699266e62ac0366e15d6a290fe13ab6a452cd(容器层) │ │ ├── lower-id │ │ ├── merged │ │ ├── upper │ │ │ ├── dev │ │ │ │ ├── console │ │ │ │ ├── pts │ │ │ │ └── shm │ │ │ ├── etc │ │ │ │ ├── hostname │ │ │ │ ├── hosts │ │ │ │ ├── mtab -> /proc/mounts │ │ │ │ └── resolv.conf │ │ │ ├── proc │ │ │ └── sys │ │ └── work │ │ └── work │ ├── 14d4a3283bd0fac4850cf1151a5699266e62ac0366e15d6a290fe13ab6a452cd-init(容器层) │ │ ├── lower-id │ │ ├── merged │ │ ├── upper │ │ │ ├── dev │ │ │ │ ├── console │ │ │ │ ├── pts │ │ │ │ └── shm │ │ │ ├── etc │ │ │ │ ├── hostname │ │ │ │ ├── hosts │ │ │ │ ├── mtab -> /proc/mounts │ │ │ │ └── resolv.conf │ │ │ ├── proc │ │ │ └── sys │ │ └── work │ │ └── work │ └── 4ff8b86a0317b5a6bd539e51ec676395e6079f4d8a77b34ff95cb8a9451279a0(镜像层) │ └── root │ └── hello ├── plugins │ ├── storage │ │ └── blobs │ │ └── tmp │ └── tmp ├── swarm ├── tmp ├── tmp-old ├── trust └── volumes └── metadata.db 59 directories, 33 files |