后台启动容器
#命令docker run -d 镜像名
docker run -d centos
#问题 docker ps ,发现centos 停止了
#常见的坑:docker 容器使用后台运行,就必须要有一个前台进程,docker发现没有应用,就会自动停止
#nginx,容器启动后,发现自己没有停止服务,就会立刻停止,就是没有程序了
查看日志
docker logs -f -t --tail 容器
# 1.自己编写一段shell 脚本
docker run -d centos /bin/sh -c "while true;do echo daidai;sleep 1;done"
# 2.查看运行的docker id
docker ps
# 3.显示日志
-tf #显示日志
--tail number #要显示的日志条数
docker logs -tf --tail 10 容器id
查看容器中的进程信息
docker top 容器id
docker top
查看镜像的元数据
#命令
docker inspect 容器id
查看镜像的元数据