对于一个容器,我们可以查看我们曾经在该容器内的操作记录,docker的logs命令可以帮助列出指定容器内曾经键入的指令以及指令返回的结果。其格式为
docker logs 容器名称或容器ID
#docker logs mysql 0;@9fa04b074651:/[root@9fa04b074651 /]# ls bin boot dev etc home lib lib64 lost+found media mnt opt proc root sbin selinux srv sys tmp usr var 0;@9fa04b074651:/[root@9fa04b074651 /]# touch new 0;@9fa04b074651:/[root@9fa04b074651 /]# ls -alh total 84K blog.nvacg.org版权所有 drwxr-xr-x 1 root root 4.0K Jul 19 06:52 . drwxr-xr-x 1 root root 4.0K Jul 19 06:52 .. dr-xr-xr-x 2 root root 4.0K Jun 27 03:00 bin drwxr-xr-x 3 root root 4.0K Jun 27 03:00 boot drwxr-xr-x 5 root root 380 Jul 19 06:51 dev -rwxr-xr-x 1 root root 0 Jul 19 06:29 .dockerenv -rwxr-xr-x 1 root root 0 Jul 19 06:29 .dockerinit drwxr-xr-x 1 root root 4.0K Jul 19 06:29 etc drwxr-xr-x 2 root root 4.0K Sep 23 2011 home dr-xr-xr-x 7 root root 4.0K Jun 27 03:00 lib dr-xr-xr-x 6 root root 12K Jun 27 03:00 lib64 drwx------ 2 root root 4.0K Jun 2 12:59 lost+found drwxr-xr-x 2 root root 4.0K Sep 23 2011 media drwxr-xr-x 2 root root 4.0K Sep 23 2011 mnt -rw-r--r-- 1 root root 0 Jul 19 06:52 new drwxr-xr-x 2 root root 4.0K Sep 23 2011 opt dr-xr-xr-x 195 root root 0 Jul 19 06:51 proc dr-xr-x--- 1 root root 4.0K Jun 27 03:00 root dr-xr-xr-x 2 root root 4.0K Jun 27 03:00 sbin drwxr-xr-x 2 root root 4.0K Jun 2 12:59 selinux drwxr-xr-x 2 root root 4.0K Sep 23 2011 srv dr-xr-xr-x 13 root root 0 Jul 19 06:51 sys drwxrwxrwt 2 root root 4.0K Jun 27 03:00 tmp drwxr-xr-x 13 root root 4.0K Jun 27 03:00 usr drwxr-xr-x 17 root root 4.0K Jun 16 03:01 var 0;@9fa04b074651:/[root@9fa04b074651 /]# exit Exit # |
请注意,本站的所有文章均要求阁下在转载时注明出处和原作者,阁下转载本站文章即表示阁下同意并遵守此规程,除非特别注明转载出处,否则文章即为其发布者所著。本站及文章作者保留文章的著作权并有权在阁下违反上述规程时予以追究。
本文链接地址: 初识DOCKER(9)–查看容器操作日志