返回

ansible安装docker-自动化批量安装docker

   
摘要GPT
摘要小助理暂时失联跑路啦……😜

基于ubuntu22.04

运行:

ansible-playbook docker_install.yaml

脚本地址

https://gitee.com/dayu777/open_shell/raw/main/docker_install.yaml
https://raw.githubusercontent.com/woniu336/open_shell/main/docker_install.yaml

无法启动docker解决

多发生在卸载重装后

清空daemon.json文件里的内容

sudo vim /etc/docker/daemon.json

重启:

sudo systemctl restart docker
sudo systemctl start docker

查看 Docker 服务状态

sudo systemctl status docker

运行 Docker 命令

sudo docker ps

服务重启后docker容器不见解决方案

服务重启后,docker服务没有自启动

重启docker

systemctl start docker

查询所有容器

docker container ls -a

重启容器

docker container start id

自动重启

docker update --restart=always NAME

 QA

报错:Cannot restart container 316c21f93fa8: failed to create task for container: task 316c21f93fa8205d1f684d69c2699e5b72525e34dd5f006636b30a7620c331bd: already exists

重启服务 reboot,然后重启容器

批量卸载docker

脚本:

https://gitee.com/dayu777/open_shell/raw/main/remove_docker.yaml

运行

ansible-playbook remove_docker.yaml
知识共享许可证 CC BY-NC-SA 4.0
最后更新于 2024-07-17 18:28
使用 Hugo 构建
主题 hugo-magic小洋葱 魔改 由 Jimmy 设计
Written by Human, Not by AI