码迷,mamicode.com
首页 > 其他好文 > 详细

centos指定默认目录安装docker

时间:2020-02-01 00:38:42      阅读:288      评论:0      收藏:0      [点我收藏+]

标签:ota   cgroup   路径   fst   ima   nta   support   fluent   plog   

挂载目录

1.挂载硬盘

fdisk /dev/sdb

2.格式化硬盘

mkfs.ext4 /dev/sdb1

echo "/dev/sdb1       /data   ext4 defaults 0 0" >> /etc/fstab

 

指定目录

1.查看默认目录

 sudo docker info | grep "Docker Root Dir"

2.停止docker服务

systemctl stop docker

3.docker的配置文件路径在/etc/docker/daemon.json,增加一个key和value,指定docker的路径:"graph": "/new-path/docker"。

默认采用的"storage-driver"是overlay2,如果使用xfs系统需要格式化的时候指定打开ftype,命令:mkfs.xfs -n ftype=1 /path/to/your/device

vim /etc/docker/daemon.json 

{
"registry-mirrors": ["https://dockerhub.azk8s.cn"],
"graph": "/data/lib/docker"
}

 mkdir -p /data/lib/docker

4.启动docker服务

systemctl start docker

 

执行docker info,查看docker信息如下:

[root@localhost ~]# docker info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 18.03.1-ce
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: false
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:
seccomp
Profile: default
Kernel Version: 3.10.0-327.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.688GiB
Name: localhost.localdomain
ID: IWSE:VMJM:POT7:VGAI:6ZZM:MJQZ:MD44:UB44:BOSJ:2D7U:HQAO:JVOZ
Docker Root Dir: /data/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Registry Mirrors:
https://dockerhub.azk8s.cn/
Live Restore Enabled: false

WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled

centos指定默认目录安装docker

标签:ota   cgroup   路径   fst   ima   nta   support   fluent   plog   

原文地址:https://www.cnblogs.com/beilong/p/12247135.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!