Docker修改默认存储位置

先Docker info 查看基本信息

root@ubuntu:~# docker info 
Containers: 2
 Running: 0
 Paused: 0
 Stopped: 2
Images: 39
Server Version: 18.05.0-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 773c489c9c1b21a6d78b5c538cd395416ec50f88
runc version: 4fc53a81fb7c994640722ac585fa9ca548971871
init version: 949e6fa
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.4.0-124-generic
Operating System: Ubuntu 16.04.4 LTS
OSType: linux
Architecture: x86_64
CPUs: 16
Total Memory: 15.66GiB
Name: allbak
ID: WDR7:SQTX:YHIB:2UCU:EY4X:RFST:INQY:EBGT:HO7M:4WFU:XXBI:YXSW
Docker Root Dir:

docker默认位置/var/lib/docker

以下是修改步骤:

1.停止docker

root@ubuntu:~# /etc/init.d/docker stop

2.迁移Docker路径  

root@ubuntu:~# cd /var/lib/
root@ubuntu:~# mv docker /media/sdj1/

3.建立软连接

ln -s /media/sdj1/docker docker

4.启动docker

root@ubuntu:~# /etc/init.d/docker start

5.docker info 再次查看信息

root@ubuntu:/var/lib/docker# docker info             
Containers: 2
 Running: 0
 Paused: 0
 Stopped: 2
Images: 39
Server Version: 18.05.0-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 773c489c9c1b21a6d78b5c538cd395416ec50f88
runc version: 4fc53a81fb7c994640722ac585fa9ca548971871
init version: 949e6fa
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.4.0-124-generic
Operating System: Ubuntu 16.04.4 LTS
OSType: linux
Architecture: x86_64
CPUs: 16
Total Memory: 15.66GiB
Name: allbak
ID: WDR7:SQTX:YHIB:2UCU:EY4X:RFST:INQY:EBGT:HO7M:4WFU:XXBI:YXSW
Docker Root Dir: /media/sdj1/docker

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值