docker images #查镜像。
docker ps # 查看正在运行的容器
docker ps -a # 查看所有容 包括停止的容器
docker start mysql5.7_1 #启动停止了的容器
docker stop mysql5.7_1 #停止运行中的容器
docker run -p 3307:3306 --name mysql5.7_1 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7
#运行mysql5.7容器。
docker exec -it mysql5.7_1 /bin/bash #进入当前正在运行的容器
mysql5.7_1docker update --restart=always mysql5.7_1 #修改容器为随docker启动
docker rename mysql5.7_tmp mysql5.7_1 #修改容器名字
[root@obce01 /]# docker version #查版本
Client: Docker Engine - Community
Version: 20.10.21
API version: 1.41
Go version: go1.18.7
Git commit: baeda1f
Built: Tue Oct 25 18:04:24 2022
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.21
API version: 1.41 (minimum version 1.12)
Go version: go1.18.7
Git commit: 3056208
Built: Tue Oct 25 18:02:38 2022
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.9
GitCommit: 1c90a442489720eec95342e1789ee8a5e1b9536f
runc:
Version: 1.1.4
GitCommit: v1.1.4-0-g5fd4c4d
docker-init:
Version: 0.19.0
GitCommit: de40ad0
[root@obce01 /]# docker --help #查帮助
Usage: docker [OPTIONS] COMMAND
A self-sufficient runtime for containers
Options:
--config string Location of client config files (default "/root/.docker")
-c, --context string Name of the context to use to connect to the daemon (overrides DOCKER_HOST env var and default
context set with "docker context use")
-D, --debug Enable debug mode
-H, --host list Daemon socket(s) to connect to
-l, --log-level string Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")
--tls Use TLS; implied by --tlsverify
--tlscacert string Trust certs signed only by this CA (default "/root/.docker/ca.pem")
--tlscert string Path to TLS certificate file (default "/root/.docker/cert.pem")
--tlskey string Path to TLS key file (default "/root/.docker/key.pem")
--tlsverify Use TLS and verify the remote
-v, --version Print version information and quit
Management Commands:
app* Docker App (Docker Inc., v0.9.1-beta3)
builder Manage builds
buildx* Docker Buildx (Docker Inc., v0.9.1-docker)
config Manage Docker configs
container Manage containers
context Manage contexts
image Manage images
manifest Manage Docker image manifests and manifest lists
network Manage networks
node Manage Swarm nodes
plugin Manage plugins
scan* Docker Scan (Docker Inc., v0.21.0)
secret Manage Docker secrets
service Manage services
stack Manage Docker stacks
swarm Manage Swarm
system Manage Docker
trust Manage trust on Docker images
volume Manage volumes
Commands:
attach Attach local standard input, output, and error streams to a running container
build Build an image from a Dockerfile
commit Create a new image from a container's changes
cp Copy files/folders between a container and the local filesystem
create Create a new container
diff Inspect changes to files or directories on a container's filesystem
events Get real time events from the server
exec Run a command in a running container
export Export a container's filesystem as a tar archive
history Show the history of an image
images List images
import Import the contents from a tarball to create a filesystem image
info Display system-wide information
inspect Return low-level information on Docker objects
kill Kill one or more running containers
load Load an image from a tar archive or STDIN
login Log in to a Docker registry
logout Log out from a Docker registry
logs Fetch the logs of a container
pause Pause all processes within one or more containers
port List port mappings or a specific mapping for the container
ps List containers
pull Pull an image or a repository from a registry
push Push an image or a repository to a registry
rename Rename a container
restart Restart one or more containers
rm Remove one or more containers
rmi Remove one or more images
run Run a command in a new container
save Save one or more images to a tar archive (streamed to STDOUT by default)
search Search the Docker Hub for images
start Start one or more stopped containers
stats Display a live stream of container(s) resource usage statistics
stop Stop one or more running containers
tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
top Display the running processes of a container
unpause Unpause all processes within one or more containers
update Update configuration of one or more containers
version Show the Docker version information
wait Block until one or more containers stop, then print their exit codes
Run 'docker COMMAND --help' for more information on a command.
To get more help with docker, check out our guides at https://docs.docker.com/go/guides/
[root@obce01 /]#
[root@obce01 mysql]# docker pull --help #拉取镜像的帮助
Usage: docker pull [OPTIONS] NAME[:TAG|@DIGEST]
Pull an image or a repository from a registry
Options:
-a, --all-tags Download all tagged images in the repository
--disable-content-trust Skip image verification (default true)
--platform string Set platform if server is multi-platform capable
-q, --quiet Suppress verbose output
[root@obce01 mysql]# docker images #查镜像。
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql 5.7 14905234a4ed 6 days ago 495MB
[root@obce01 mysql]#
[root@obce01 mysql]# docker pull mysql #拉取镜像
Using default tag: latest
latest: Pulling from library/mysql
d67a603b911a: Pull complete
0cf69c8f1492: Pull complete
a5ee239a0d3a: Pull complete
0f166cb3e327: Pull complete
882d294bf188: Pull complete
2649fc7eb806: Pull complete
bddb3394e2e3: Pull complete
93c83d9a2206: Pull complete
99d7f45787c0: Pull complete
234663a2e3ee: Pull complete
74531487bb7b: Pull complete
Digest: sha256:d4055451e7f42869e64089a60d1abc9e66eccde2910629f0dd666b53a5f230d8
Status: Downloaded newer image for mysql:latest
docker.io/library/mysql:latest
[root@obce01 mysql]#
[root@obce01 mysql]#
[root@obce01 mysql]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql latest c2c2eba5ae85 16 hours ago 535MB
mysql 5.7 14905234a4ed 6 days ago 495MB
[root@obce01 mysql]# docker pull tomcat
Using default tag: latest
latest: Pulling from library/tomcat
301a8b74f71f: Pull complete
c5c735a83dbd: Pull complete
d6fe64428cde: Pull complete
9901108da602: Pull complete
a86e915b5d6a: Pull complete
6bf9140ba1d5: Pull complete
769f39243fd8: Pull complete
Digest: sha256:a24495b50762ae6d0310f6ea9ccd2fa830cebc621a8a0162f828e9d046dd2a85
Status: Downloaded newer image for tomcat:latest
docker.io/library/tomcat:latest
[root@obce01 mysql]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql latest c2c2eba5ae85 16 hours ago 535MB
tomcat latest 6dd589e60602 34 hours ago 474MB
mysql 5.7 14905234a4ed 6 days ago 495MB
[root@obce01 mysql]#
[root@obce01 mysql]# docker rmi -f tomcat #删除镜像
Untagged: tomcat:latest
Untagged: tomcat@sha256:a24495b50762ae6d0310f6ea9ccd2fa830cebc621a8a0162f828e9d046dd2a85
Deleted: sha256:6dd589e606022f555f8a39d4889e4a37e4e14470f4c9a9f57a79c8b9cdccbfc7
Deleted: sha256:cce47c3fae0b8d8e30a04eeeab26e6c5e4536c5fbcffe0126a39ec1b03905670
Deleted: sha256:1287eb6aaa0e0c795e9609440d99406d241e0d0cd914ab43712d69c03a1ab50c
Deleted: sha256:778fac53bcce0d1fb012f4f7456f930834231e80460f15116da7e973f104da76
Deleted: sha256:065276e5dc11080c0a3da7255588806a04b686e55df58b1ebb32708ab461c5be
Deleted: sha256:cbafe4d15dd0853951279f80c7888093a1b4f66b2fe1273ff3a3de9ac6391da4
Deleted: sha256:ed4679b9380a9f5b3b446e3cfa048f9bb616df5a020176081cae97fe292913fb
Deleted: sha256:7ea4455e747ead87d6cc1c4efaf3a79530a931a0856a9f9ce9ac2d8d45bd3c28
[root@obce01 mysql]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql latest c2c2eba5ae85 16 hours ago 535MB
mysql 5.7 14905234a4ed 6 days ago 495MB
[root@obce01 mysql]#
[root@obce01 mysql]#
[root@obce01 mysql]# docker save mysql -o /mysql.tar #保存镜像
[root@obce01 mysql]#
[root@obce01 mysql]# cd /
[root@obce01 /]# ls
bin daemon dev hadoop home lib64 mnt mysql opt redo run srv tmp usr
boot data etc hadoop lib media mydata mysql.tar proc root sbin sys u01 var
[root@obce01 /]# du -sh mysql.tar
1010M mysql.tar
[root@obce01 /]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql latest c2c2eba5ae85 16 hours ago 535MB
mysql 5.7 14905234a4ed 6 days ago 495MB
[root@obce01 /]# docker rmi -f mysql
Untagged: mysql:latest
Untagged: mysql@sha256:d4055451e7f42869e64089a60d1abc9e66eccde2910629f0dd666b53a5f230d8
Deleted: sha256:c2c2eba5ae857a8ab9bffd11c5f15ed693dc65ac035948696f370f2895ae3062
Deleted: sha256:210b4dce38af03de3f57240d06ca8ca60b426a30b84ea74a35a61bd42caff054
Deleted: sha256:ba25a3896ed49216e74d63280aa2797490babecb29779ef128994a3ed84241ce
Deleted: sha256:d3860b757f15dd46d3e1dd6098611a1478a57630ca92f5a9fa8f7f0dc08559f1
Deleted: sha256:f1a04d895a8bd362e477e5654cd24c5f4f3cefdff99a1dc5073408d21ea4ac60
Deleted: sha256:b648b662b97c6ddb59fac71ce7860297060624fff5102f021a69f38c09df58fd
Deleted: sha256:c3a7ba2a7418cdfd9e3d58af2488f73921499254c0761644caf5dbb057951323
Deleted: sha256:86349bd8052cbee20aab4ab699c5b553e57de91a7038850c881bc57be6c78862
Deleted: sha256:25698a118589bb2e601dcbe9f6d6ab72678a6b033ecc90ae83e767138c892dce
Deleted: sha256:d9da521068fe6f1de86d0894c7234069abdae3f9db44e923c66614bb3e2e999b
Deleted: sha256:1c63c8b11ddd9ac84858ee47dfab5464bd2581fb48fefef75b3c16ba32176e75
Deleted: sha256:bb4173a55532f72ee01e6aa78ee0208d520b2825596ca90ac73a5be99b38012f
[root@obce01 /]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql 5.7 14905234a4ed 6 days ago 495MB
[root@obce01 /]#
[root@obce01 /]# docker load -i /mysql.tar #加载镜像
Loaded image: mysql:5.7
bb4173a55532: Loading layer [==================================================>] 106.8MB/106.8MB
447c959ed7ca: Loading layer [==================================================>] 11.26kB/11.26kB
7623ecfa9ced: Loading layer [==================================================>] 2.293MB/2.293MB
15b866165bfa: Loading layer [==================================================>] 13.9MB/13.9MB
74f1760df263: Loading layer [==================================================>] 7.168kB/7.168kB
216abd9deea9: Loading layer [==================================================>] 3.072kB/3.072kB
31d80fb1385c: Loading layer [==================================================>] 178.4MB/178.4MB
a0b5c1c527f1: Loading layer [==================================================>] 3.072kB/3.072kB
4b256c6ebea5: Loading layer [==================================================>] 246.4MB/246.4MB
a9cc8f217428: Loading layer [==================================================>] 17.41kB/17.41kB
fd69a81fbde1: Loading layer [==================================================>] 1.536kB/1.536kB
Loaded image: mysql:latest
[root@obce01 /]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql latest c2c2eba5ae85 16 hours ago 535MB
mysql 5.7 14905234a4ed 6 days ago 495MB
[root@obce01 /]#
[root@obce01 /]# docker ps #查运行中的容器
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@obce01 /]# docker ps -a #查所有容器
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b2f619097811 mysql:5.7 "docker-entrypoint.s…" 30 minutes ago Exited (0) 21 minutes ago mysql5.7_3
e83f7ae714aa mysql:5.7 "docker-entrypoint.s…" 30 minutes ago Exited (0) 21 minutes ago mysql5.7_2
10860e2535be mysql:5.7 "docker-entrypoint.s…" About an hour ago Exited (0) 21 minutes ago brave_diffie
54f2681f4259 mysql:5.7 "docker-entrypoint.s…" About an hour ago Exited (1) About an hour ago mysql1
2d31708b3189 mysql:5.7 "docker-entrypoint.s…" About an hour ago Created mysql
[root@obce01 /]# docker rm -f mysql1 mysql brave_diffie #删除容器
mysql1
mysql
brave_diffie
[root@obce01 /]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b2f619097811 mysql:5.7 "docker-entrypoint.s…" 43 minutes ago Exited (0) 33 minutes ago mysql5.7_3
e83f7ae714aa mysql:5.7 "docker-entrypoint.s…" 43 minutes ago Exited (0) 33 minutes ago mysql5.7_2
[root@obce01 /]# docker run -p 3307:3306 --name mysql5.7_1 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7 #运行mysql5.7容器。
99e0c576e3621edc018f6b0a4e4ec8f3b97664f69337bb64c005b7b00e825099
[root@obce01 /]#
[root@obce01 /]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
99e0c576e362 mysql:5.7 "docker-entrypoint.s…" 2 seconds ago Up 1 second 33060/tcp, 0.0.0.0:3307->3306/tcp mysql5.7_1
b2f619097811 mysql:5.7 "docker-entrypoint.s…" 43 minutes ago Exited (0) 34 minutes ago mysql5.7_3
e83f7ae714aa mysql:5.7 "docker-entrypoint.s…" 44 minutes ago Exited (0) 34 minutes ago mysql5.7_2
[root@obce01 /]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
99e0c576e362 mysql:5.7 "docker-entrypoint.s…" 31 seconds ago Up 30 seconds 33060/tcp, 0.0.0.0:3307->3306/tcp mysql5.7_1
[root@obce01 /]# docker start mysql5.7_2 #启动容器
mysql5.7_2
[root@obce01 /]# docker start mysql5.7_3
mysql5.7_3
[root@obce01 /]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
99e0c576e362 mysql:5.7 "docker-entrypoint.s…" 46 seconds ago Up 45 seconds 33060/tcp, 0.0.0.0:3307->3306/tcp mysql5.7_1
b2f619097811 mysql:5.7 "docker-entrypoint.s…" 44 minutes ago Up 1 second 33060/tcp, 0.0.0.0:3309->3306/tcp mysql5.7_3
e83f7ae714aa mysql:5.7 "docker-entrypoint.s…" 45 minutes ago Up 3 seconds 33060/tcp, 0.0.0.0:3308->3306/tcp mysql5.7_2
[root@obce01 /]#
[root@obce01 /]# docker exec -it mysql5.7_1 /bin/bash #进入mysql容器
bash-4.2# mysql -uroot -p123456
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.40 MySQL Community Server (GPL)
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
mysql> quit
Bye
bash-4.2# exit
exit
[root@obce01 /]# docker exec -it mysql5.7_1 /bin/bash
bash-4.2#
bash-4.2# mkdir lzj
bash-4.2# ls
bin dev entrypoint.sh home lib64 media opt root sbin sys usr
boot docker-entrypoint-initdb.d etc lib lzj mnt proc run srv tmp var
bash-4.2# cd lzj
bash-4.2# ls
bash-4.2# touch test.txt
bash-4.2# ls
test.txt
bash-4.2# echo "sdfdsf">test.txt
bash-4.2# cat test.txt
sdfdsf
bash-4.2# exit
exit
[root@obce01 /]# docker cp mysql5.7_1:/lzj/test.txt / #从容器中拷贝数据出来。
[root@obce01 /]# pwd
/
[root@obce01 /]# ls
bin daemon dev hadoop home lib64 mnt mysql opt redo run srv test.txt u01 var
boot data etc hadoop lib media mydata mysql.tar proc root sbin sys tmp usr
[root@obce01 /]# more test.txt
sdfdsf
[root@obce01 /]# vi lzj.a
adfsdfliuzhijian
~
~
~
"lzj.a" [New] 1L, 17C written
[root@obce01 /]# docker cp /lzj.a mysql5.7_1:/lzj/ #从外面拷贝数据到容器中。
[root@obce01 /]# docker exec -it mysql5.7_1 /bin/bash
bash-4.2#
bash-4.2# cd lzj
bash-4.2# ls
lzj.a test.txt
bash-4.2# cat lzj.a
adfsdfliuzhijian
bash-4.2#
[root@obce01 /]# docker logs -f --tail=30 mysql5.7_1 #查看容器日志
2022-10-28T10:02:08.130500Z 0 [Note] InnoDB: Number of pools: 1
2022-10-28T10:02:08.130762Z 0 [Note] InnoDB: Using CPU crc32 instructions
2022-10-28T10:02:08.134373Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2022-10-28T10:02:08.149439Z 0 [Note] InnoDB: Completed initialization of buffer pool
2022-10-28T10:02:08.153923Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2022-10-28T10:02:08.167917Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2022-10-28T10:02:08.182383Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2022-10-28T10:02:08.182547Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2022-10-28T10:02:08.211340Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2022-10-28T10:02:08.212865Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2022-10-28T10:02:08.212893Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2022-10-28T10:02:08.213675Z 0 [Note] InnoDB: Waiting for purge to start
2022-10-28T10:02:08.263945Z 0 [Note] InnoDB: 5.7.40 started; log sequence number 12139879
2022-10-28T10:02:08.264706Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2022-10-28T10:02:08.264908Z 0 [Note] Plugin 'FEDERATED' is disabled.
2022-10-28T10:02:08.273512Z 0 [Note] InnoDB: Buffer pool(s) load completed at 221028 10:02:08
2022-10-28T10:02:08.276520Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2022-10-28T10:02:08.276549Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2022-10-28T10:02:08.276557Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2022-10-28T10:02:08.276561Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2022-10-28T10:02:08.277676Z 0 [Warning] CA certificate ca.pem is self signed.
2022-10-28T10:02:08.277784Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2022-10-28T10:02:08.278243Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2022-10-28T10:02:08.280919Z 0 [Note] IPv6 is not available.
2022-10-28T10:02:08.280997Z 0 [Note] - '0.0.0.0' resolves to '0.0.0.0';
2022-10-28T10:02:08.281039Z 0 [Note] Server socket created on IP: '0.0.0.0'.
2022-10-28T10:02:08.283041Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2022-10-28T10:02:08.301125Z 0 [Note] Event Scheduler: Loaded 0 events
2022-10-28T10:02:08.301570Z 0 [Note] mysqld: ready for connections.
Version: '5.7.40' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
^C
[root@obce01 /]#
[root@obce01 /]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
99e0c576e362 mysql:5.7 "docker-entrypoint.s…" 29 minutes ago Up 29 minutes 33060/tcp, 0.0.0.0:3307->3306/tcp mysql5.7_1
b2f619097811 mysql:5.7 "docker-entrypoint.s…" About an hour ago Up 28 minutes 33060/tcp, 0.0.0.0:3309->3306/tcp mysql5.7_3
e83f7ae714aa mysql:5.7 "docker-entrypoint.s…" About an hour ago Up 28 minutes 33060/tcp, 0.0.0.0:3308->3306/tcp mysql5.7_2
[root@obce01 /]# docker update --restart=always mysql5.7_1 #修改容器为随docker启动
mysql5.7_1
[root@obce01 /]# docker update --restart=always mysql5.7_2
mysql5.7_2
[root@obce01 /]# docker update --restart=always mysql5.7_3
mysql5.7_3
[root@obce01 /]# docker rename mysql5.7_1 mysql5.7_tmp
[root@obce01 /]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
99e0c576e362 mysql:5.7 "docker-entrypoint.s…" 30 minutes ago Up 30 minutes 33060/tcp, 0.0.0.0:3307->3306/tcp mysql5.7_tmp
b2f619097811 mysql:5.7 "docker-entrypoint.s…" About an hour ago Up 29 minutes 33060/tcp, 0.0.0.0:3309->3306/tcp mysql5.7_3
e83f7ae714aa mysql:5.7 "docker-entrypoint.s…" About an hour ago Up 29 minutes 33060/tcp, 0.0.0.0:3308->3306/tcp mysql5.7_2
[root@obce01 /]# docker rename mysql5.7_tmp mysql5.7_1 #修改容器名字
[root@obce01 /]#
[root@obce01 /]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
99e0c576e362 mysql:5.7 "docker-entrypoint.s…" 30 minutes ago Up 30 minutes 33060/tcp, 0.0.0.0:3307->3306/tcp mysql5.7_1
b2f619097811 mysql:5.7 "docker-entrypoint.s…" About an hour ago Up 30 minutes 33060/tcp, 0.0.0.0:3309->3306/tcp mysql5.7_3
e83f7ae714aa mysql:5.7 "docker-entrypoint.s…" About an hour ago Up 30 minutes 33060/tcp, 0.0.0.0:3308->3306/tcp mysql5.7_2
[root@obce01 /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 50G 27G 24G 53% /
devtmpfs 4.8G 0 4.8G 0% /dev
tmpfs 4.9G 48K 4.9G 1% /dev/shm
tmpfs 4.9G 73M 4.8G 2% /run
tmpfs 4.9G 0 4.9G 0% /sys/fs/cgroup
/dev/vdb 99G 37G 57G 39% /data
tmpfs 984M 0 984M 0% /run/user/0
overlay 50G 27G 24G 53% /var/lib/docker/overlay2/7723de68fec2aed197217b6530a513718d9062081fba45d0d6b9dcf1b9aaf165/merged
overlay 50G 27G 24G 53% /var/lib/docker/overlay2/61326e65c6a1af1818e7724a89e4d6661870b92bdea25d1405834492f120c019/merged
overlay 50G 27G 24G 53% /var/lib/docker/overlay2/1557fc0092b4bc18a72a374f626bc26782527f2655d4852772cbc7436fff70c9/merged
[root@obce01 ~]# docker info | grep "Docker Root Dir" #查看docker工作目录
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
Docker Root Dir: /var/lib/docker
[root@obce01 ~]# du -sh /var/lib/docker #查看docker占用空间。
6.3G /var/lib/docker
[root@obce01 ~]#
[root@obce01 /]# docker system df #查看docker磁盘使用空间具体情况。
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 2 1 1.03GB 535.5MB (51%)
Containers 3 3 488B 0B (0%)
Local Volumes 4 3 865.6MB 207MB (23%)
Build Cache 0 0 0B 0B