标签:ota port 管理 blocks dockers .com nbsp client []
1.启动docker
sudo systemctl start docker
sudo systemctl restart docker
sudo systemctl stop docker
sudo systemctl status docker
sudo docker info
Containers: 1
Running: 0
Paused: 0
Stopped: 1
Images: 2
Server Version: 17.03.1-ce
Storage Driver: devicemapper
Pool Name: vgdocker-thinpool
Pool Blocksize: 524.3 kB
Base Device Size: 10.74 GB
Backing Filesystem: xfs
Data file:
Metadata file:
Data Space Used: 2.708 GB
Data Space Total: 20.4 GB
Data Space Available: 17.69 GB
Metadata Space Used: 1.917 MB
Metadata Space Total: 213.9 MB
Metadata Space Available: 212 MB
Thin Pool Minimum Free Space: 2.039 GB
Udev Sync Supported: true
Deferred Removal Enabled: true
Deferred Deletion Enabled: true
Deferred Deleted Device Count: 0
Library Version: 1.02.135-RHEL7 (2016-11-16)
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: 4ab9917febca54791c5f071a9d1f404867857fcc
runc version: 54296cf40ad8143b62dbcaa1d90e520a2136ddfe
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-123.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.69 GiB
Name: wgl
ID: 2GXU:7CL7:ETAC:BTYX:M4V6:JSMV:3CIJ:4OZC:KKKX:D5IV:DVBX:T3KV
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
sudo docker run --name wgl_centos -i -t centos /bin/bash
sudo docker rename oldername newname
sudo docker ps -a #显示全部容器
sudo docker ps -l #列出最后一个运行的容器,也可以--format进一步控制显示
sudo docker ps -n x #显示最后x个容器。
sudo docker start(restart,stop) 容器ID(容器name)
sudo docker attach 容器
sudo docker run --name wgl_centos_daemon -d centos /bin/sh -c "while true;do echo hello world;sleep 3;done"
sudo docker logs 容器 #输出最后几条后返回
sudo docker logs -f 容器 #监控日志
sudo docker logs --tail 10 容器 #获取容器日志最后10条
sudo docker logs --tail 0 -f 容器 #跟踪最新日志
sudo docker logs -ft 容器 #监控日志+时间戳
sudo docker run --log-driver="syslog" --name wgl_centos_daemon -d centos /bin/sh -c "while true;do echo hello world;sleep 3;done"
sudo docker top wgl_centos_daemon
sudo docker stats [容器1 容器2 容器3 ...]
sudo docker exec -d 53fc4852ce08 touch /opt/wgl.log # -u 为新启动的进程指定属主
sudo docker exec -it 53fc4852ce08 /bin/bash
sudo docker run --restart=always --name wgl_centos_daemon -d centos /bin/sh -c "while true;do echo hello world;sleep 3;done"
sudo docker inspect 容器
[dwsoft@wgl ~]$ sudo docker inspect wgl_centos_daemon
[
{
"Id": "53fc4852ce081422068efa8bdcbad05d8b51b4fe2ba0a4389c91508dc3fbd50a",
"Created": "2017-05-28T05:35:00.155823247Z",
"Path": "/bin/sh",
"Args": [
"-c",
"while true;do echo hello world;sleep 3;done"
],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 6450,
"ExitCode": 0,
"Error": "",
"StartedAt": "2017-05-28T05:35:01.363485741Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "sha256:8140d0c64310d4e290bf3938757837dbb8f806acba0cb3f6a852558074345348",
"ResolvConfPath": "/var/lib/docker/containers/53fc4852ce081422068efa8bdcbad05d8b51b4fe2ba0a4389c91508dc3fbd50a/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/53fc4852ce081422068efa8bdcbad05d8b51b4fe2ba0a4389c91508dc3fbd50a/hostname",
"HostsPath": "/var/lib/docker/containers/53fc4852ce081422068efa8bdcbad05d8b51b4fe2ba0a4389c91508dc3fbd50a/hosts",
"LogPath": "/var/lib/docker/containers/53fc4852ce081422068efa8bdcbad05d8b51b4fe2ba0a4389c91508dc3fbd50a/53fc4852ce081422068efa8bdcbad05d8b51b4fe2ba0a
4389c91508dc3fbd50a-json.log", "Name": "/wgl_centos_daemon",
"RestartCount": 0,
"Driver": "devicemapper",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "default",
"PortBindings": {},
"RestartPolicy": {
"Name": "no",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": null,
"CapAdd": null,
"CapDrop": null,
"Dns": [],
"DnsOptions": [],
"DnsSearch": [],
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "",
"Cgroup": "",
"Links": null,
"OomScoreAdj": 0,
"PidMode": "",
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"UTSMode": "",
"UsernsMode": "",
"ShmSize": 67108864,
"Runtime": "runc",
"ConsoleSize": [
0,
0
],
"Isolation": "",
"CpuShares": 0,
"Memory": 0,
"NanoCpus": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": null,
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": 0,
"CpuQuota": 0,
"CpuRealtimePeriod": 0,
"CpuRealtimeRuntime": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": [],
"DiskQuota": 0,
"KernelMemory": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": -1,
"OomKillDisable": false,
"PidsLimit": 0,
"Ulimits": null,
"CpuCount": 0,
"CpuPercent": 0,
"IOMaximumIOps": 0,
"IOMaximumBandwidth": 0
},
"GraphDriver": {
"Name": "devicemapper",
"Data": {
"DeviceId": "76",
"DeviceName": "docker-253:1-277138-721bd5780ec0a2800c9db53413e77636e96e787a4b330b9d665c2cf289c01c43",
"DeviceSize": "10737418240"
}
},
"Mounts": [],
"Config": {
"Hostname": "53fc4852ce08",
"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",
"while true;do echo hello world;sleep 3;done"
],
"Image": "centos",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {
"build-date": "20170510",
"license": "GPLv2",
"name": "CentOS Base Image",
"vendor": "CentOS"
}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "dc56c0446f06b8b53b914574c34ec35c09fa38bc9d43d70ba5750aef60915597",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {},
"SandboxKey": "/var/run/docker/netns/dc56c0446f06",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "0da7299f69c100fce911e1c6b12f333e56ff30e3ff7a2f799ee595af89265fc8",
"Gateway": "172.17.0.1",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"MacAddress": "02:42:ac:11:00:02",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "23e919387bcf6493c7bdcd91e31b8995132fb7f081cfbac7778e855c6a4f6d58",
"EndpointID": "0da7299f69c100fce911e1c6b12f333e56ff30e3ff7a2f799ee595af89265fc8",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:02"
}
}
}
}
]
sudo docker rm 容器
sudo docker rm -f 容器 #删除正在运行的容器
标签:ota port 管理 blocks dockers .com nbsp client []
原文地址:http://www.cnblogs.com/wglIT/p/6915659.html