Docker copy files / View container various information

View container information

ubuntu@ubuntu18:/tmp/dockertmp$ docker inspect test4
[
    {
        "Id": "c9c0a5538d1a83f1a41d28d5aff1e66b3c4599d339dc6f3bb29f1bd6100577fb",
        "Created": "2020-02-20T02:22:20.939460356Z",
        "Path": "/bin/sh",
        "Args": [
            "-c",
            "while true;do echo hello world;sleep 1;done"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 27256,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2020-02-20T02:22:21.478737596Z",
            "FinishedAt": "0001-01-01T00:00:00Z"

View Process

ubuntu@ubuntu18:/tmp/dockertmp$ docker top test4
UID                 PID                 PPID                C                   STIME               TTY                 TIME                CMD
root                27256               27222               0                   10:22               ?                   00:00:00            /bin/sh -c while true;do echo hello world;sleep 1;done
root                28616               27256               0                   10:28               ?                   00:00:00            sleep 1

Viewing Status Information

ubuntu@ubuntu18:/tmp/dockertmp$ docker stats test4
CONTAINER ID        NAME                CPU %               MEM USAGE / LIMIT     MEM %               NET I/O             BLOCK I/O           PIDS
c9c0a5538d1a        test4               0.12%               2.703MiB / 3.817GiB   0.07%               8.59kB / 0B         188kB / 0B          2

Copy files

ubuntu@ubuntu18:/tmp/dockertmp$ docker cp flag 32f4ce2760f6:/tmp/

Change View

ubuntu@ubuntu18:/tmp/dockertmp$ docker diff test5

View port mapping

ubuntu@ubuntu18:/tmp/dockertmp$ docker port test5

Quickly delete all closed containers

ubuntu@ubuntu18:/tmp/dockertmp$ docker ps -a | grep Exit | cut -d ' ' -f 1 | xargs docker rm
30a4648e1c65
074aa8e19fbf
17d43e4455b4
4e4fe0554c9c
2806eea2660c
003275e570f7

Published 61 original articles · won praise 22 · views 4227

Guess you like

Origin blog.csdn.net/yiqiushi4748/article/details/104412566