一. 在镜像中定义卷

1. Dockerfile中定义卷的案例

VOLUME /app/data
VOLUME /app/data, /app/profiles, /app/config
VOLUME ["/app/data", "/app/profiles", "/app/config"]

注解:

  • 第一行代表定义一个单 一的卷挂载在/app/data。
  • 第二行代表定义了三个卷,使用逗号进行分隔
  • 第三行代表定义了三个卷,只不过使用的是JSON数组

2. 获取数据卷信息案例1

(1)拉取名字叫做mongo:3.7的镜像

[root@c720120 ~]# docker image pull mongo:3.7
3.7: Pulling from library/mongo
b234f539f7a1: Pull complete
55172d420b43: Pull complete

(2)使用docker image inspect命令检查数据卷信息

[root@c720120 ~]# docker image inspect    --format='{{json .ContainerConfig.Volumes}}'     mongo:3.7
{"/data/configdb":{},"/data/db":{}}

(3)运行mongodb的实例

[root@c720120 ~]# docker run --name my-mongo -d mongo:3.7
0145aa8906d9e62823e091c3fbcfbce50bc27b27224f2cca456182d0dc52d9bc

(4)获取卷创建的详细信息

[root@c720120 ~]# docker inspect --format '{{json .Mounts}}' my-mongo
[{"Type":"volume","Name":"654e63e15e1366b10f661b5909bf5823e70637adf75252f4d7bdace5db3da357","Source":"/var/lib/docker/volumes/654e63e15e1366b10f661b5909bf5823e70637adf75252f4d7bdace5db3da357/_data","Destination":"/data/configdb","Driver":"local","Mode":"","RW":true,"Propagation":""},{"Type":"volume","Name":"083ed210294f7c7333d31f72123f5f2030caf0dfa56c5ba9375c590fbb9da99b","Source":"/var/lib/docker/volumes/083ed210294f7c7333d31f72123f5f2030caf0dfa56c5ba9375c590fbb9da99b/_data","Destination":"/data/db","Driver":"local","Mode":"","RW":true,"Propagation":""}]

二. 获得Docker系统的信息

1. 获得Docker基本信息

[root@c720120 ~]# docker version
Client:
  Version:      18.05.0-ce
  API version:  1.37
  Go version:   go1.9.5
  Git commit:   f150324
  Built:        Wed May  9 22:14:54 2018
  OS/Arch:      linux/amd64
  Experimental: false
  Orchestrator: swarm

Server:
  Engine:
   Version:      18.05.0-ce
   API version:  1.37 (minimum version 1.12)
   Go version:   go1.9.5
   Git commit:   f150324
   Built:        Wed May  9 22:18:36 2018
   OS/Arch:      linux/amd64
   Experimental: false

2. 获得Docker的系统相关信息

[root@c720120 ~]# docker system info
Containers: 22
  Running: 18
  Paused: 0
  Stopped: 4
Images: 55
Server Version: 18.05.0-ce
Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
  Volume: local
  Network: bridge host macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 773c489c9c1b21a6d78b5c538cd395416ec50f88
runc version: 4fc53a81fb7c994640722ac585fa9ca548971871
init version: 949e6fa
Security Options:
  seccomp
   Profile: default
Kernel Version: 3.10.0-693.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 7.641GiB
Name: c720120.xiodi.cn
ID: 3LFN:DY55:44IN:ZYQF:SCLG:LH7U:P2XQ:RLOP:WMMN:O7OA:C5Z5:KFC6
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Username: mike0405
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
  127.0.0.0/8
Registry Mirrors:
  https://av0eyibf.mirror.aliyuncs.com/
Live Restore Enabled: false

三. 检查Docker主机的资源消耗

1. 显示当前使用的资源和多少空间可能会被回收

[root@c720120 ~]# docker system df
TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images              34                  12                  3.32GB              2.159GB (65%)
Containers          22                  18                  10.66kB             126B (1%)
Local Volumes       6                   3                   362.1MB             47.24MB (13%)
Build Cache

2. 如果想要显示更中详细的信息,使用-v选项。

[root@c720120 ~]# docker system df -v
Images space usage:

REPOSITORY                                                             TAG                 IMAGE ID            CREATED ago         SIZE                SHARED SIZE         UNIQUE SiZE         CONTAINERS
mongo                                                                  3.7                 5651314706c2        3 hours ago ago     365.3MB             0B                  365.3MB             1
my-website                                                             1.0                 26a2c3c3133d        10 hours ago ago    18MB                18MB                99B                 1
<none>                                                                 <none>              51e46f702575        10 hours ago ago    18MB                18MB                73B                 0
hello-world                                                            latest              e6de691461d8        10 hours ago ago    177.8MB             4.148MB             173.6MB             0
my-centos                                                              latest              fcc50aa21ce3        11 hours ago ago    271.7MB             199.7MB             71.97MB             0
<none>                                                                 <none>              48746de3c746        11 hours ago ago    902.3MB             902.3MB             0B                  0
my-alpine                                                              latest              dd2e0b200d6d        12 hours ago ago    5.647MB             4.148MB             1.499MB             0
centos                                                                 7                   49f7960eb7e4        27 hours ago ago    199.7MB             199.7MB             0B                  0
quay.io/kubernetes-for-developers/nodejs                               0.2.0               593c8caeab0d        4 days ago ago      65.38MB             10.56MB             54.83MB             0
quay.io/kubernetes-for-developers/flask                                0.1.0               affcedaf18ef        4 days ago ago      64.97MB             10.56MB             54.41MB             0
busybox                                                                latest              8c811b4aec35        13 days ago ago     1.146MB             0B                  1.146MB             0
python                                                                 2.7                 5a7d0660d94a        4 weeks ago ago     902.3MB             902.3MB             0B                  0
nginx                                                                  alpine              ebe2c7c61055        8 weeks ago ago     18MB                18MB                0B                  0
k8s.gcr.io/kube-proxy-amd64                                            v1.10.0             bfc21aadc7d3        2 months ago ago    97.04MB             0B                  97.04MB             1
k8s.gcr.io/kube-scheduler-amd64                                        v1.10.0             704ba848e69a        2 months ago ago    50.39MB             1.146MB             49.25MB             1
k8s.gcr.io/kube-apiserver-amd64                                        v1.10.0             af20925d51a3        2 months ago ago    225MB               1.146MB             223.8MB             1
k8s.gcr.io/kube-controller-manager-amd64                               v1.10.0             ad86dbed1555        2 months ago ago    147.8MB             1.146MB             146.7MB             1
k8s.gcr.io/etcd-amd64                                                  3.1.12              52920ad46f5b        2 months ago ago    193.2MB             1.146MB             192.1MB             0
fundamentalsofdocker/ch08-web                                          1.0                 922e085ed002        3 months ago ago    72.01MB             3.966MB             68.04MB             0
fundamentalsofdocker/ch08-db                                           1.0                 4953d5353c17        3 months ago ago    39.46MB             4.148MB             35.31MB             0
coredns/coredns                                                        1.0.6               d4b7466213fe        3 months ago ago    39.88MB             0B                  39.88MB             2
k8s.gcr.io/kubernetes-dashboard-amd64                                  v1.8.3              0c60bcf89900        3 months ago ago    102.3MB             0B                  102.3MB             2
registry.cn-shenzhen.aliyuncs.com/rancher_cn/heapster-amd64            v1.5.1              c41e77c31c91        3 months ago ago    75.32MB             0B                  75.32MB             0
<none>                                                                 <none>              65f32704f7a3        4 months ago ago    10.12MB             3.966MB             6.149MB             0
quay.io/coreos/flannel                                                 v0.10.0-amd64       f0fad859c909        4 months ago ago    44.6MB              4.148MB             40.45MB             2
registry.cn-hangzhou.aliyuncs.com/k8sth/heapster-grafana-amd64         v4.4.3              edd7018a59de        4 months ago ago    151.5MB             1.129MB             150.4MB             0
alpine                                                                 3.7                 3fd9065eaf02        4 months ago ago    4.148MB             4.148MB             0B                  1
k8s.gcr.io/k8s-dns-dnsmasq-nanny-amd64                                 1.14.8              c2ce1ffb51ed        5 months ago ago    40.95MB             0B                  40.95MB             0
k8s.gcr.io/k8s-dns-sidecar-amd64                                       1.14.8              6f7f2dc7fab5        5 months ago ago    42.21MB             4.144MB             38.07MB             0
k8s.gcr.io/k8s-dns-kube-dns-amd64                                      1.14.8              80cc5ea4b547        5 months ago ago    50.46MB             4.144MB             46.31MB             0
k8s.gcr.io/pause-amd64                                                 3.1                 da86e6ba6ca1        5 months ago ago    742.5kB             0B                  742.5kB             0
ubuntu                                                                 17.04               fe1cc5b91830        5 months ago ago    95.63MB             0B                  95.63MB             1
registry.cn-shenzhen.aliyuncs.com/rancher_cn/heapster-influxdb-amd64   v1.3.3              577260d221db        9 months ago ago    12.55MB             1.129MB             11.42MB             0
registry.cn-hangzhou.aliyuncs.com/k8sth/pause-amd64                    3.0                 99e59f495ffa        2 years ago ago     746.9kB             0B                  746.9kB             8

Containers space usage:

CONTAINER ID        IMAGE                                                     COMMAND                  LOCAL VOLUMES       SIZE                CREATED ago         STATUS                    NAMES
0145aa8906d9        mongo:3.7                                                 "docker-entrypoint.s…"   2                   0B                  8 minutes ago ago   Up 8 minutes              my-mongo
557b896ff138        my-website:1.0                                            "nginx -g 'daemon of…"   0                   2B                  10 hours ago ago    Up 10 hours               my-site
f29815cfea52        ubuntu:17.04                                              "/bin/bash"              1                   73B                 10 hours ago ago    Exited (1) 10 hours ago   reader
02f3d25fe440        alpine                                                    "/bin/sh"                1                   53B                 10 hours ago ago    Exited (0) 10 hours ago   writer
eddd516d5c67        0c60bcf89900                                              "/dashboard --insecu…"   0                   0B                  10 hours ago ago    Up 10 hours               k8s_kubernetes-dashboard_kubernetes-dashboard-7b44ff9b77-87vnz_kube-system_f4b7d3c3-6354-11e8-aec8-525400da66d3_2
f628fc5261cb        0c60bcf89900                                              "/dashboard --insecu…"   0                   0B                  10 hours ago ago    Exited (1) 10 hours ago   k8s_kubernetes-dashboard_kubernetes-dashboard-7b44ff9b77-87vnz_kube-system_f4b7d3c3-6354-11e8-aec8-525400da66d3_1
4497d8983aa8        f0fad859c909                                              "/opt/bin/flanneld -…"   0                   0B                  10 hours ago ago    Up 10 hours               k8s_kube-flannel_kube-flannel-ds-jpn69_kube-system_d511775a-6350-11e8-aec8-525400da66d3_0
150eb223d319        d4b7466213fe                                              "/coredns -conf /etc…"   0                   5.27kB              10 hours ago ago    Up 10 hours               k8s_coredns_coredns-7997f8864c-bqjl6_kube-system_06d0a127-634e-11e8-8a76-525400da66d3_0
ce50540a5da6        d4b7466213fe                                              "/coredns -conf /etc…"   0                   5.27kB              10 hours ago ago    Up 10 hours               k8s_coredns_coredns-7997f8864c-7flkx_kube-system_06cd6faf-634e-11e8-8a76-525400da66d3_0
20ec466d4e7d        ad86dbed1555                                              "kube-controller-man…"   0                   0B                  10 hours ago ago    Up 10 hours               k8s_kube-controller-manager_kube-controller-manager-c720120.xiodi.cn_kube-system_9ebd85f31a07b860847b300d2124c485_0
ccc1fa2f461b        bfc21aadc7d3                                              "/usr/local/bin/kube…"   0                   0B                  10 hours ago ago    Up 10 hours               k8s_kube-proxy_kube-proxy-8g8xs_kube-system_06d4d12f-634e-11e8-8a76-525400da66d3_0
1e8615e3be7d        f0fad859c909                                              "cp -f /etc/kube-fla…"   0                   0B                  10 hours ago ago    Exited (0) 10 hours ago   k8s_install-cni_kube-flannel-ds-jpn69_kube-system_d511775a-6350-11e8-aec8-525400da66d3_0
818acc639132        af20925d51a3                                              "kube-apiserver --re…"   0                   0B                  10 hours ago ago    Up 10 hours               k8s_kube-apiserver_kube-apiserver-c720120.xiodi.cn_kube-system_dc5a90c76fa85961f74db59b5ef2e0c1_0
68f022ef851b        704ba848e69a                                              "kube-scheduler --ku…"   0                   0B                  10 hours ago ago    Up 10 hours               k8s_kube-scheduler_kube-scheduler-c720120.xiodi.cn_kube-system_ca4d1ecae9f198efae15156d524bb1d0_0
5184cfdeab1d        registry.cn-hangzhou.aliyuncs.com/k8sth/pause-amd64:3.0   "/pause"                 0                   0B                  10 hours ago ago    Up 10 hours               k8s_POD_kube-flannel-ds-jpn69_kube-system_d511775a-6350-11e8-aec8-525400da66d3_0
f5b09907ac58        registry.cn-hangzhou.aliyuncs.com/k8sth/pause-amd64:3.0   "/pause"                 0                   0B                  10 hours ago ago    Up 10 hours               k8s_POD_kube-controller-manager-c720120.xiodi.cn_kube-system_9ebd85f31a07b860847b300d2124c485_0
94637d8b8614        registry.cn-hangzhou.aliyuncs.com/k8sth/pause-amd64:3.0   "/pause"                 0                   0B                  10 hours ago ago    Up 10 hours               k8s_POD_kube-proxy-8g8xs_kube-system_06d4d12f-634e-11e8-8a76-525400da66d3_0
f8965fe90c07        registry.cn-hangzhou.aliyuncs.com/k8sth/pause-amd64:3.0   "/pause"                 0                   0B                  10 hours ago ago    Up 10 hours               k8s_POD_coredns-7997f8864c-bqjl6_kube-system_06d0a127-634e-11e8-8a76-525400da66d3_0
09ac5692e5ac        registry.cn-hangzhou.aliyuncs.com/k8sth/pause-amd64:3.0   "/pause"                 0                   0B                  10 hours ago ago    Up 10 hours               k8s_POD_kube-apiserver-c720120.xiodi.cn_kube-system_dc5a90c76fa85961f74db59b5ef2e0c1_0
c788ac0d3604        registry.cn-hangzhou.aliyuncs.com/k8sth/pause-amd64:3.0   "/pause"                 0                   0B                  10 hours ago ago    Up 10 hours               k8s_POD_kube-scheduler-c720120.xiodi.cn_kube-system_ca4d1ecae9f198efae15156d524bb1d0_0
d0ee0f4e50bb        registry.cn-hangzhou.aliyuncs.com/k8sth/pause-amd64:3.0   "/pause"                 0                   0B                  10 hours ago ago    Up 10 hours               k8s_POD_kubernetes-dashboard-7b44ff9b77-87vnz_kube-system_f4b7d3c3-6354-11e8-aec8-525400da66d3_0
b8b969bf904a        registry.cn-hangzhou.aliyuncs.com/k8sth/pause-amd64:3.0   "/pause"                 0                   0B                  10 hours ago ago    Up 10 hours               k8s_POD_coredns-7997f8864c-7flkx_kube-system_06cd6faf-634e-11e8-8a76-525400da66d3_0

Local Volumes space usage:

VOLUME NAME                                                        LINKS               SIZE
docker_pets-data                                                   0                   47.24MB
my-data                                                            0                   57B
share-data                                                         2                   20B
shared-data                                                        0                   0B
654e63e15e1366b10f661b5909bf5823e70637adf75252f4d7bdace5db3da357   1                   0B
083ed210294f7c7333d31f72123f5f2030caf0dfa56c5ba9375c590fbb9da99b   1                   314.8MB

四. 修剪未使用的资源

1. 修剪未使用的容器

(1)修剪容器(没有在运行状态的容器)

[root@c720120 ~]# docker container prune
WARNING! This will remove all stopped containers.
Are you sure you want to continue? [y/N] y
Deleted Containers:
f29815cfea52eae2dd2e37a43d5260f5265299852f8f216ca7437b76222739c2
02f3d25fe440b709840abb055bff25ad9a90ce12acdcd2734249e5a8faff6b2d
f628fc5261cb26d15ff7d24b02abc992392c54a736f0333d9cee16cc324e24da
1e8615e3be7d24f41060319cb762a3e66b7470ab74c5af87285d6c0003f1b99e

Total reclaimed space: 126B

(2)如果在修剪时不想再次确认,可以使用-f或者—force选项。

[root@c720120 ~]# docker container prune –f

(3)如果想要移除所有的容器(包括那些在运行的),prune命令无法做到,使用以下命令.

[root@c720120 ~]# docker container rm -f $(docker container ls -aq)

2. 修剪镜像

(1)修剪镜像(没有在使用的镜像)

[root@c720120 ~]# docker image prune

(2)修剪镜像,如果不想再三确认,请使用-f或者—force选项。

[root@c720120 ~]# docker image prune –f

(3)移除所有的镜像,不仅是那些孤立的镜像

[root@c720120 ~]# docker image prune –-force –all

3. 修剪卷

(1)修剪卷(没有在使用的卷)

[root@c720120 ~]# docker volume prune

(2)修剪过滤器过滤的指定的卷

[root@c720120 ~]# docker volume prune –filter ‘label=demo’

也可以使用多个过滤器过滤卷

[root@c720120 ~]# docker volume prune –filter ‘label=demo’ –filter ‘label=test’

4. 修剪网络

[root@c720120 ~]# docker network prune

5. 执行一条命令,修剪所有的东西,包括卷,网络,容器,镜像。

[root@c720120 ~]# docker system prune

五. Docker系统事件

当docker引擎在创建,运行,停止 和移除容器和其它资源时,比如卷和网络,均会产生事件日志。

案例1:

(1)开启系统事件

[root@c720120 ~]# docker system events

(2)在Docker host的另一个终端上执行创建容器命令。

[root@c720120 ~]# docker container run --rm alpine echo "Hello World"
Hello World

(3)查看输出的事件信息

[root@c720120 ~]# docker system events
2018-06-06T09:51:45.412499798+08:00 container create 26f1bc504b5d19735558085005225a6d7ecb7bebd4c4f060c1a20c565a130cef (image=alpine, name=gifted_bassi)
2018-06-06T09:51:45.417325987+08:00 container attach 26f1bc504b5d19735558085005225a6d7ecb7bebd4c4f060c1a20c565a130cef (image=alpine, name=gifted_bassi)
2018-06-06T09:51:45.536770127+08:00 network connect 8d4ce133354ba6e3ab01684cf18b88535230647e78a6d698f1ef8d79f767b169 (container=26f1bc504b5d19735558085005225a6d7ecb7bebd4c4f060c1a20c565a130cef, name=bridge, type=bridge)
2018-06-06T09:51:46.087623064+08:00 container start 26f1bc504b5d19735558085005225a6d7ecb7bebd4c4f060c1a20c565a130cef (image=alpine, name=gifted_bassi)
2018-06-06T09:51:46.218351340+08:00 container die 26f1bc504b5d19735558085005225a6d7ecb7bebd4c4f060c1a20c565a130cef (exitCode=0, image=alpine, name=gifted_bassi)
2018-06-06T09:51:46.376077683+08:00 network disconnect 8d4ce133354ba6e3ab01684cf18b88535230647e78a6d698f1ef8d79f767b169 (container=26f1bc504b5d19735558085005225a6d7ecb7bebd4c4f060c1a20c565a130cef, name=bridge, type=bridge)
2018-06-06T09:51:46.467148084+08:00 container destroy 26f1bc504b5d19735558085005225a6d7ecb7bebd4c4f060c1a20c565a130cef (image=alpine, name=gifted_bassi)

(4)让输出事件信息按指定的格式进行输出

[root@c720120 ~]#  docker system events --format 'Type={{.Type}} Image={{.Actor.Attributes.image}} Action={{.Action}}'

(5)输出信息如下

[root@c720120 ~]#  docker system events --format 'Type={{.Type}} Image={{.Actor.Attributes.image}} Action={{.Action}}'
Type=container Image=alpine Action=create
Type=container Image=alpine Action=attach
Type=network Image=<no value> Action=connect
Type=container Image=alpine Action=start
Type=container Image=alpine Action=die
Type=network Image=<no value> Action=disconnect
Type=container Image=alpine Action=destroy

Docker数据卷和Docker系统管理(二)的更多相关文章

  1. Docker数据卷和Docker系统管理(一)

    一. 创建和挂载数据卷 1. 创建数据卷 (1)执行下列命令,创建一个名为my-data的数据卷 [root@c720120 ~]# docker volume create my-data my-d ...

  2. docker 数据卷和docker数据卷容器以及数据卷的备份和还原

    一:数据卷 1.什么是数据卷 数据卷是通过特殊设计的目录,可以绕过联合文件系统,为一个或者多个容器提供服务,数据卷是在docker宿主机当中,数据卷可以是文件也可以是文件夹. 2.特点 1.数据卷在容 ...

  3. docker数据卷学习-利用数据卷实现mysql的快速恢复和迁移

    docker数据卷学习 一 新建带有数据卷的容器 1.从docker hub下载centos7镜像 # docker pull centos 2. 创建container # docker run - ...

  4. Docker学习第三天(Docker数据卷管理)

    1.Docker数据卷管理 在Docker中,要想实现数据的持久化(所谓Docker的数据持久化即数据不随着Container的结束而结束),需要将数据从宿主机挂载到容器中.目前Docker提供了三种 ...

  5. docker 数据卷之进阶篇

    笔者在<Docker 基础 : 数据管理>一文中介绍了 docker 数据卷(volume) 的基本用法.随着使用的深入,笔者对 docker 数据卷的理解与认识也在不断的增强.本文将在前 ...

  6. 1.docker 数据卷的备份和恢复(非大数据量)

    在生产环境中使用 Docker,很多时候需要对数据进行持久化,或者进行容器间的数据共享. 容器中的管理数据主要有两种方式: 数据卷 (Data Volumes): 容器内数据直接映射到本地主机环境: ...

  7. 聊聊Docker数据卷和数据卷容器

    当程序在容器运行的时候,特别是需要与其他容器中的程序或容器外部程序进行沟通交流,这时需要进行数据交换,作为常用的两种沟通数据的方式,网络通信与文件读写是需要提供给程序的支持, [数据卷] 文件是数据持 ...

  8. docker 数据卷 ---- 进阶篇

    笔者在<Docker 基础 : 数据管理>一文中介绍了 docker 数据卷(volume) 的基本用法.随着使用的深入,笔者对 docker 数据卷的理解与认识也在不断的增强.本文将在前 ...

  9. 实例解析Docker数据卷+数据卷容器+flocker数据共享+DockerHub操作

    Docker内部数据管理和Docker之间的数据共享为数据卷和数据卷容器,实例解析1.将本地的文件作为容器的数据卷,2.数据卷flocker插件实现容器集群(或者Docker Swarm)的数据共享3 ...

随机推荐

  1. Nginx报错 nginx: [error] open() "/usr/local/nginx-1.6.3/logs/nginx.pid" failed (2: No such file or directory)

    问题: 解决: http://www.jianshu.com/p/918eb337a206 dd

  2. libevent文档学习(一)多线程接口和使用

    参考libevent官方提供的文档: http://www.wangafu.net/~nickm/libevent-book/Ref1_libsetup.html 这一篇主要翻译libevent多线程 ...

  3. python基础--文件操作实现全文或单行替换

    python修改文件时,使用w模式会将原本的文件清空/覆盖.可以先用读(r)的方式打开,写到内存中,然后再用写(w)的方式打开. 替换文本中的taste 为 tasting Yesterday whe ...

  4. HTTP、TCP、 UDP、 IP 、 Socket的关系

    TCP和UDP协议是传输协议,IP是网络层协议.传输协议和网络层协议主要解决数据如何在网络中传输,或者说TCP/IP 定义了电子设备如何连入因特网,以及数据如何在它们之间传输的标准.TCP负责发现传输 ...

  5. Vue DatePicker和不可用

    input控件可以直接设置disabled为不可用状态: DatePicker要想不可编辑,设置readonly属性即可 <DatePicker type="date" v- ...

  6. UVA 1390 Interconnect

    https://vjudge.net/problem/UVA-1390 题意: 给出n个点m条边的无向图, 每次随机加一条非自环的边,(加完后可出现重边), 添加每条边的概率是相等的 求使图连通的期望 ...

  7. Codeforces 148 D Bag of mice

    D. Bag of mice http://codeforces.com/problemset/problem/148/D time limit per test 2 seconds memory l ...

  8. Python学习笔记(十五)用Python获取本地数据

    f1 = open(r'E:\Python\Data\data1.txt') #读取data1.txt文件,使用系统默认缓冲区大小, 为了读取快点,使用缓存吧! f = open(r'E:\Pytho ...

  9. 响应式布局之媒体查询 @media

    Media Queries,其作用就是允许添加表达式用以确定媒体的环境情况,以此来应用不同的样式表.换句话说,其允许我们在不改变内容的情况下,改变页面的布局以精确适应不同的设备. 媒体查询有两种玩法, ...

  10. DHTML Object Model&DHTML&DOM

    DHTML Object Model:DHTML对象模型,利用DHTML Object Model可以单独操作页面上的对象,每个HTML标记通过它的ID和NAME属性被操纵,每个对象都具有自己的属性. ...