docker会下载容器,运行会挂载磁盘,所以我们需要把docker装在大容量的分区。

安装

https://docs.docker.com/install/linux/docker-ce/centos/

修改位置

查看我们挂载的磁盘

# df -h
Filesystem Size Used Avail Use% Mounted on
udev 7.8G 0 7.8G 0% /dev
tmpfs 1.6G 1.7M 1.6G 1% /run
/dev/sda2 110G 18G 86G 18% /
tmpfs 7.8G 152M 7.7G 2% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/sdb1 916G 77M 870G 1% /data
/dev/sda1 511M 6.1M 505M 2% /boot/efi
tmpfs 1.6G 16K 1.6G 1% /run/user/121
tmpfs 1.6G 28K 1.6G 1% /run/user/1000
tmpfs 1.6G 0 1.6G 0% /run/user/0

选择 /data作为docker容器存放地址。


docker info #查看docker的基本信息
#停止docker服务
systemctl stop docker #备份原目录
cp -r /var/lib/docker /data/docker
mv /var/lib/docker /var/lib/docker.bak
ln -s /data/docker /var/lib/docker
systemctl start docker

运行Hello world



# docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal. To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/ For more examples and ideas, visit:
https://docs.docker.com/get-started/

查看docker info



# docker info
Containers: 3
Running: 0
Paused: 0
Stopped: 3
Images: 1
Server Version: 18.09.7
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 local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc version: 425e105d5a03fabd737a126ad93d62a9eeede87f
init version: fec3683
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.18.0-20-generic
Operating System: Ubuntu 18.04.2 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.54GiB
Name: ryan-computer
ID: P5ON:MZEK:XB4K:63NP:DTUX:BQHY:72AR:OP4G:JQ2M:JNDL:T6TU:6NEJ
Docker Root Dir: /data/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
Live Restore Enabled: false
Product License: Community Engine WARNING: No swap limit support

安装docker后修改docker文件目录的更多相关文章

  1. Docker(十七)-修改Docker容器启动配置参数

    有时候,我们创建容器时忘了添加参数 --restart=always ,当 Docker 重启时,容器未能自动启动, 现在要添加该参数怎么办呢,方法有二: 1.Docker 命令修改 docker c ...

  2. 安装Oracle后修改IP总结(转载)

    转载自:http://blog.csdn.net/bleibo/article/details/5447198 安装Oracle后修改IP总结(转载) 针对ORACLE 10G 在安装完后,修改IP ...

  3. Oracle安装完成后修改服务器机器名,Oracle部分服务无法启动

    Oracle安装完成后修改服务器机器名,Windows server 2012 R2系统提示Oracle 11g下面3个服务无法启动: OracleDBConsoleorcl OracleOraDb1 ...

  4. 【亲测有效】Centos安装完成docker后启动docker报错docker: unrecognized service的两种解决方案

    今天在学习Docker的时候 使用yum install docker安装完后启动不了,报错如下: [root@Sakura ~]# service docker start docker: unre ...

  5. Docker: 如何修改 Docker 的镜像存储位置

    我用的阿里云的服务器, 但是系统盘只有20G, 默认 Docker 的镜像文件是安装在/var/lib 目录下的, 这样的话我根本装不了太多的镜像... 这个必须得改改... 搜了下, 解决方案如下: ...

  6. win7下安装mysql后修改密码

    mysql的安装教程网上很多,此处不过多介绍,个人觉得下面这篇教程是比较好的,一步到位.MySQL 5.7.9 ZIP 免安装版本配置过程_百度经验  http://jingyan.baidu.com ...

  7. linux 安装mysql后修改密码出现问题

    新安装的mysql 执行命令时候出现错误: 一 错误信息: ERROR 1045 (28000): Access denied for user 'mysql'@'localhost' (using ...

  8. oracle11g安装完成后修改字符集

    author : headsen chen date:2018-05-10  10:27:16 oracle11g完成安装后,由于默认安装的时候无法指定字符集,所以手动修改字符集和10g版本一样的字符 ...

  9. windows中安装模拟器后修改模拟器中的hosts方法

    1.背景 有的时候我们测试安卓的app需要绑定hosts,这个时候我们如果只是修改PC机器上的hosts,然而在模拟器中并不生效.这个时候我们就需要修改模拟器中的hosts. 模拟器中的hosts为只 ...

随机推荐

  1. python 实例方法、静态方法、类方法

    class Date: #构造函数 def __init__(self, year, month, day): self.year = year self.month = month self.day ...

  2. attention 汇总(持续)

    Seq2seq Attention Normal Attention 1.  在decoder端,encoder state要进行一个线性变换,得到r1,可以用全连接,可以用conv,取决于自己,这里 ...

  3. MongoDB for OPS 02:复制集 RS 配置

    写在前面的话 对于生产环境而言,除非是非常不重要的业务,且该业务允许我们出现一定时间的停机,我们一般才会使用单节点,且该单节点必须要有完善的备份手段. RS 复制集 我们这里采取一主两从的方式搭建复制 ...

  4. Python Turtle绘画初学编程——六芒星,浪形圈

    老师上课说可以自学一下python中的绘图turtle,就自己初步学习了一下,做了两个简单的绘图——六芒星和浪形圈(其实我也不知道该叫它什么,就照样子编了个词

  5. C#测试对比不同类型的方法调用的性能

    一. 测试方法调用形式 1. 实例方法调用 2. 静态方法调用 3. 实例方法反射调用 4. 委托方法的Invoke调用 5. 委托方法的DynamicInvoke调用 6.委托方法的BeginInv ...

  6. vue-品牌管理案例

    品牌管理 分析 获取到 id 和 name ,直接从 data 上面获取 组织出一个对象 把这个对象,调用 数组的 相关方法,添加到 当前 data 上的 list 中 注意:在Vue中,已经实现了数 ...

  7. java基础(22):File、递归

    1. File 1.1 IO概述 回想之前写过的程序,数据都是在内存中,一旦程序运行结束,这些数据都没有了,等下次再想使用这些数据,可是已经没有了.那怎么办呢?能不能把运算完的数据都保存下来,下次程序 ...

  8. PHP通过session判断防止表单重复提交实例

    PHP通过session判断防止表单重复提交实例,当用户提交表单后,为防止重复操作,通过session来判断是否为初次提交,否则让他返回到之前表单页面. 当前表单页面is_submit设为0 SESS ...

  9. Java生鲜电商平台-API请求性能调优与性能监控

    Java生鲜电商平台-API请求性能调优与性能监控 背景 在做性能分析时,API的执行时间是一个显著的指标,这里使用SpringBoot AOP的方式,通过对接口添加简单注解的方式来打印API的执行时 ...

  10. Linux常用命令(2)

    3.帮助命令 A,帮助命令:man    B,其他帮助命令 3.1,格式:man [命令名] 查看命令拥有哪个级别的帮助:                                       ...