docker image 的说明查看
https://hub.docker.com/r/XXXXXX
查看镜像
docker images
docker images -a
删除镜像
docker rm
查看运行的容器
docker ps
docker ps -a
停止容器
docker stop
删除容器
docker rm
停止、启动、杀死、重启一个容器
docker stop Name或者ID
docker start Name或者ID
docker kill Name或者ID
docker restart name或者ID
查看日志
docker logs --details 930ef4f1df52
docker logs -f xxx //查看日志,实时更新
docker inspect --format='{{.LogPath}}' <容器ID>
echo > 日志路径
echo "" > $(docker inspect --format='{{.LogPath}}' <容器ID>)
进入运行的容器目录
docker exec -it 948 bash
docker exec -it 948 sh
docker 设置以及运行的容器为自动重启
docker update --restart=always xxx 修改成自动开始
--restart= no, on-failure, always 和 unless-stopped
创建镜像
docker build ~/Desktop/yapi/yapi-docker/ -t xxx/yapi
修改镜像tag
docker tag 容器ID tagname
查看容器详细信息
docker inspect 容积或镜像ID
重启DOCKER 服务
sudo service docker restart
systemctl restart docker
创建 空的docker image
错误运行不起来 bash && tail -f /dev/null
清空DOCKER 未用资源
查看
docker system df
清空未用的images与停止的containers
docker system prune
docker system prune -a
清空未用的volume
docker volume prune
docker 升级前备份 images 与 容器
docker 备份 image :
docker save -o ./xxx-backup.tar xxx-backup
docker 备份 容器 :
1.停止
2.备份成新的IMAGES
docker commit -p 136e6e580929 xxx-backup
docker 恢复
docker load -i ~/xxx-backup.tar
docker 设置以及运行的容器内存
docker update --memory 2048m --memory-swap -1 gitlab
Docker学习日记_常用命令
最新推荐文章于 2024-05-12 22:18:09 发布