zoukankan      html  css  js  c++  java
  • 安装docker后修改docker文件目录

    原文章链接:https://blog.csdn.net/weixin_30374009/article/details/97597830?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-3.nonecase&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-3.nonecase

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

    修改位置

    查看我们挂载的磁盘

    # 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
    

      转载于:https://blog.csdn.net/weixin_30374009/article/details/97597830?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-3.nonecase&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-3.nonecase

  • 相关阅读:
    idea添加自定义插件仓库 灵狐插件、阿里代码规约插件安装&idea插件推荐
    常用版本名称含义:SNAPSHOT->alpha->beta->release->GA等
    Ambari Centos7离线安装教程详细指导(参考)
    JDK11变化详解&JDK8升级JDK11详细指南
    idea jdk8、jdk9、jdk11、jdk12并自由切换
    idea java EclipseFormatter代码格式化模板
    java基础对象浅复制和深复制(基础知识)
    斐讯路由器L(联)B(壁)K-码兑换包安全下车通道(图文教程)
    SipDroid +miniSIPServer搭建SIP局域网语音通话(一)
    Android Studio 找不到EventBus/ButterKnife等第三方包解决方案
  • 原文地址:https://www.cnblogs.com/snooker/p/12931153.html
Copyright © 2011-2022 走看看