Cloud Native应用交付

  • 首页
  • 关于本站
  • 个人介绍
  • Downloads
  • Repo
    • Github
    • Container
  • F5
    • F5 Python SDK
    • F5-container
    • F5-LBaaS
  • 社交
    • 联系我
    • 微信/微博
    • 公众号
    • 打赏赞助
行至水穷处 坐看云起时
Cloud Native Application Services: cnadn.net
  1. 首页
  2. 容器/k8s
  3. 正文

Docker学习备忘1

2017年05月9日 7153点热度 0人点赞 0条评论

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

相关文章

  • docker 容器粗体验之:快速搭建 Wordpress in containers
  • F5 CES 用融合的思想保护k8s出向流量安全
  • F5-k8s解决方案(2)-基于Calico BGP网络的F5 k8s容器平台方案实践
  • 博客Docker化实践
  • DOCKER容器跨宿主机通信方法(4):Flannel-Vxlan
本作品采用 知识共享署名-非商业性使用 4.0 国际许可协议 进行许可
标签: docker 容器
最后更新:2017年06月24日

纳米

linjing.io

打赏 点赞
< 上一篇
下一篇 >
页面AI聊天助手

纳米

linjing.io

☁️迈向Cloud Native ADC ☁️

认证获得:
TOGAF: ID 152743
Kubernetes: CKA #664
Microsoft: MCSE MCDBA
Cisco: CCNP
Juniper: JNCIS
F5:
F5 Certified Solution Expert, Security
F5 Certified Technology Specialist, LTM/GTM/APM/ASM
F5 Certified BIG-IP Administrator
  • 点击查看本博技术要素列表
  • 归档
    分类
    • AI
    • Automation
    • Avi Networks
    • Cisco ACI
    • CISCO资源
    • F5 with ELK
    • F5-Tech tips
    • F5技术
    • Juniper
    • Linux
    • NGINX
    • SDN
    • ServiceMesh
    • WEB编程
    • WINDOWS相关
    • 业界文章
    • 交换机技术
    • 化云为雨/Openstack
    • 协议原理
    • 容器/k8s
    • 我的工作
    • 我的生活
    • 网站技术
    • 路由器技术
    • 项目案例
    标签聚合
    istio bigip DNS neutron F5 nginx openstack envoy api gtm docker k8s flannel irule network
    最近评论
    汤姆 发布于 8 个月前(09月10日) 嗨,楼主,里面的json怎么下载啊,怎么收费啊?
    汤姆 发布于 8 个月前(09月09日) 大佬,kib的页面可以分享下吗?谢谢
    zhangsha 发布于 1 年前(05月12日) 资料发给我下,谢谢纳米同志!!!!lyx895@qq.com
    李成才 发布于 1 年前(01月02日) 麻烦了,谢谢大佬
    纳米 发布于 1 年前(01月02日) 你好。是的,因为以前下载系统插件在一次升级后将所有的下载生成信息全弄丢了。所以不少文件无法下载。DN...
    浏览次数
    • Downloads - 183,781 views
    • 联系我 - 118,966 views
    • 迄今为止最全最深入的BIGIP-DNS/GTM原理及培训资料 - 116,529 views
    • Github - 103,675 views
    • F5常见log日志解释 - 79,777 views
    • 从传统ADC迈向CLOUD NATIVE ADC - 下载 - 74,629 views
    • Sniffer Pro 4 70 530抓包软件 中文版+视频教程 - 74,320 views
    • 迄今为止最全最深入的BIGIP-DNS/GTM原理及培训资料 - 67,770 views
    • 关于本站 - 60,921 views
    • 这篇文档您是否感兴趣 - 55,498 views
    链接表
    • F5SE创新
    • Jimmy Song‘s Blog
    • SDNlab
    • Service Mesh社区
    • 三斗室
    • 个人profile
    • 云原生社区

    COPYRIGHT © 2023 Cloud Native 应用交付. ALL RIGHTS RESERVED.

    Theme Kratos Made By Seaton Jiang

    京ICP备14048088号-1

    京公网安备 11010502041506号