docker修改工作目录
最编程
2024-02-23 06:57:08
...
开始之前请务必给服务器打快照!!!
开始之前请务必给服务器打快照!!!
开始之前请务必给服务器打快照!!!
- docker 默认安装在 /var/lib/docker 目录下
$ docker info | grep -i dir
Docker Root Dir: /var/lib/docker
- 关闭docker
$ systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: inactive (dead) since Sun 2024-02-18 17:37:36 CST; 3s ago
Docs: https://docs.docker.com
Process: 32670 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=0/SUCCESS)
Main PID: 32670 (code=exited, status=0/SUCCESS)
Feb 18 17:37:12 iZ8vb4dtxhzjq6edcdznleZ dockerd[32670]: time="2024-02-18T17:37:12.236566810+08:00" level=info msg="Loading containers: done."
Feb 18 17:37:12 iZ8vb4dtxhzjq6edcdznleZ dockerd[32670]: time="2024-02-18T17:37:12.256596144+08:00" level=info msg="Docker daemon" commit=e2f740d graphdriver(s)=overlay2 version=20.10.10
Feb 18 17:37:12 iZ8vb4dtxhzjq6edcdznleZ dockerd[32670]: time="2024-02-18T17:37:12.256642864+08:00" level=info msg="Daemon has completed initialization"
Feb 18 17:37:12 iZ8vb4dtxhzjq6edcdznleZ systemd[1]: Started Docker Application Container Engine.
Feb 18 17:37:12 iZ8vb4dtxhzjq6edcdznleZ dockerd[32670]: time="2024-02-18T17:37:12.269168156+08:00" level=info msg="API listen on /var/run/docker.sock"
Feb 18 17:37:36 iZ8vb4dtxhzjq6edcdznleZ systemd[1]: Stopping Docker Application Container Engine...
Feb 18 17:37:36 iZ8vb4dtxhzjq6edcdznleZ dockerd[32670]: time="2024-02-18T17:37:36.971997368+08:00" level=info msg="Processing signal 'terminated'"
Feb 18 17:37:36 iZ8vb4dtxhzjq6edcdznleZ dockerd[32670]: time="2024-02-18T17:37:36.972590865+08:00" level=info msg="stopping event stream following graceful shutdown" error="<nil>" module=libcontainerd namespace=moby
Feb 18 17:37:36 iZ8vb4dtxhzjq6edcdznleZ dockerd[32670]: time="2024-02-18T17:37:36.972830242+08:00" level=info msg="Daemon shutdown complete"
Feb 18 17:37:36 iZ8vb4dtxhzjq6edcdznleZ systemd[1]: Stopped Docker Application Container Engine.
- 移动工作目录到其他目录
$ mv /var/lib/docker /data/
- 修改配置文件,如果没有,则新建
$ vim /etc/docker/daemon.json
- daemon.json文件如下:
“data-root”:“/data/docker” 是新增的
注意:如果原先有内容,在上一行添加 ,(逗号)
{
"registry-mirrors":["https://registry.docker-cn.com"],
"data-root":"/data/docker"
}
- 启动docker
$ systemctl start docker.service
推荐阅读
-
创建 Docker 映像的 Dockerfile
-
企业级项目实战品达物流TMS(资料齐全)SpringCloud+SpringBoot+Vue+Mybatis-Plus+Docker19套JAVA企业级大型项目实战前后端分离/微服务/云原生/分布式/高并发/高可用/中间平台策略项目架构、百亿级项目实战、金融项目实战JAVA项目、物联网项目、项目面试实战、秒杀项目实战、租房项目实战、在线教育项目实战、权限系统实战、股票交易项目、短信平台实战、房源平台项目实战、工作流项目实战。
-
Docker 入门:从零开始构建容器化应用程序环境
-
docker-compose docker 的批量管理工具
-
使用 docker-compose 协调 lnmp(dockerfile) 以完成 wordpress
-
计算电费:终于明白目录电价的用途了
-
使用 Docker 和 Homeassistant,让家庭用电更轻松,帮您省电省钱
-
docker 登录 查看已登录账户
-
用于 Docker 的数据管理、网络通信和 dockerfile
-
秋季招聘刷新目录表 1 (202405) - 秋季招聘算法刷新