亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

docker 安裝、升級(jí)、修改數(shù)據(jù)目錄的操作方法

 更新時(shí)間:2024年08月20日 10:53:57   作者:蘭嘉軒  
這篇文章主要介紹了docker 安裝、升級(jí)、修改數(shù)據(jù)目錄的操作方法,本文給大家介紹的非常詳細(xì),感興趣的朋友跟隨小編一起看看吧

1、查看系統(tǒng)要求

Docker 要求 CentOS 系統(tǒng)的內(nèi)核版本高于 3.10 ,查看CentOS的內(nèi)核版本。

uname -a

2、刪除舊版本

yum remove docker  docker-common docker-selinux docker-engine

3、安裝需要的軟件包

yum-util 提供yum-config-manager功能,另外兩個(gè)是devicemapper驅(qū)動(dòng)依賴的

sudo yum install -y yum-utils device-mapper-persistent-data lvm2

4、設(shè)置Docker yum源

# 使用官方源
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
# 使用阿里源
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo sed -i 's+download.docker.com+mirrors.aliyun.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo

5、查看所有倉庫中所有docker版本

可以查看所有倉庫中所有docker版本,并選擇特定的版本安裝。

yum list docker-ce --showduplicates | sort -r

6、安裝docker

sh

sudo yum install docker-ce

由于repo中默認(rèn)只開啟stable倉庫,故這里安裝的是最新穩(wěn)18.03.0.ce-1.el7.centos。

如果要安裝特定版本:

sudo yum install docker-ce-18.06.1.ce

7、啟動(dòng)

設(shè)置為開機(jī)啟動(dòng)

systemctl enable docker

啟動(dòng)

systemctl start docker

查看啟動(dòng)狀態(tài)

systemctl status docker

如果出現(xiàn)異常

$ systemctl start docker
A dependency job for docker.service failed. See 'journalctl -xe' for details.

查看報(bào)錯(cuò)信息

Mar 03 11:19:47 master1 systemd[1]: Starting containerd container runtime...
-- Subject: Unit containerd.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit containerd.service has begun starting up.
Mar 03 11:19:47 master1 systemd[104332]: Failed at step LIMITS spawning /sbin/modprobe: Operation not permitted
-- Subject: Process /sbin/modprobe could not be executed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- The process /sbin/modprobe could not be executed and failed.
-- 
-- The error number returned by this process is 1.
Mar 03 11:19:47 master1 systemd[104335]: Failed at step LIMITS spawning /usr/bin/containerd: Operation not permitted
-- Subject: Process /usr/bin/containerd could not be executed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- The process /usr/bin/containerd could not be executed and failed.

解決方案:
查看open files的值,修改/usr/lib/systemd/system/docker.service和/usr/lib/systemd/system/containerd.service(如下圖),啟動(dòng)即可

$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 23056
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 654350
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 23056
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
$ vim /usr/lib/systemd/system/docker.service
...
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=654349 # 注意這里
LimitNPROC=23057
LimitCORE=infinity
# Comment TasksMax if your systemd version does not supports it.
...
$ vim /usr/lib/systemd/system/containerd.service
...
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=654349 # 注意這里
LimitNPROC=23057
LimitCORE=infinity
# Comment TasksMax if your systemd version does not support it.
...

查看版本

docker version

8、修改數(shù)據(jù)目錄

方式一

# 將下面的json拷貝紙docker啟動(dòng)目錄
$ vim /etc/docker/daemon.json
{
	"data-root": "/data/docker"
}

方式二

查看docker當(dāng)前信息

$ docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Docker Buildx (Docker Inc., v0.8.2-docker)
  scan: Docker Scan (Docker Inc., v0.17.0)
Server:
 Containers: 40
  Running: 15
  Paused: 0
  Stopped: 25
 Images: 91
 Server Version: 20.10.17
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
 runc version: v1.1.2-0-ga916309f
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 3.10.0-1160.71.1.el7.x86_64
 Operating System: CentOS Linux 7 (Core)
 OSType: linux
 Architecture: x86_64
 CPUs: 16
 Total Memory: 15.5GiB
 Name: master1
 ID: 3WQC:QCTB:I5D4:2ZWL:VBSH:6GWQ:4W2G:BTK2:XSEY:PDXG:BQAI:ZB6D
 Docker Root Dir: /data/docker   # 這里是數(shù)據(jù)目錄的位置,我因?yàn)橐呀?jīng)更改過,原位置為/var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Registry Mirrors:
  https://x6u7jv2l.mirror.aliyuncs.com/
 Live Restore Enabled: false

9、停止docker服務(wù)

$ systemctl stop docker

10、修改docker服務(wù)啟動(dòng)文件

vi /usr/lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --graph=/data/docker

11、復(fù)制原有數(shù)據(jù),若無數(shù)據(jù),可跳過此步驟

$ cp -rf /var/lib/docker/* /data/docker/

12、重新加載配置文件并啟動(dòng)

$  systemctl daemon-reload
$ systemctl start docker

最后執(zhí)行步驟8,查看是否已啟動(dòng)

到此這篇關(guān)于docker 安裝、升級(jí)、修改數(shù)據(jù)目錄的操作方法的文章就介紹到這了,更多相關(guān)docker 修改數(shù)據(jù)目錄內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • docker環(huán)境下分布式運(yùn)行jmeter的教程詳解

    docker環(huán)境下分布式運(yùn)行jmeter的教程詳解

    這篇文章主要介紹了docker環(huán)境下分布式運(yùn)行jmeter的教程,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-10-10
  • docker import 命令的使用

    docker import 命令的使用

    本文主要介紹了docker import 命令的使用,與 docker load 不同,docker import 可以從容器快照中創(chuàng)建新的鏡像,而不需要保留鏡像的歷史和元數(shù)據(jù),下面就來了解一下
    2025-04-04
  • 在Ubuntu中安裝Docker教程

    在Ubuntu中安裝Docker教程

    這篇文章主要介紹了在Ubuntu中安裝Docker教程,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2016-12-12
  • CentOS7.2下安裝docker容器教程

    CentOS7.2下安裝docker容器教程

    Docker是一個(gè)開源的軟件部署工具,是輕量級(jí)的應(yīng)用容器框架,它可以讓創(chuàng)建和管理 CentOS容器變得簡(jiǎn)單。容器就像是輕量級(jí)的虛擬機(jī),并且可以以毫秒級(jí)的速度來啟動(dòng)或停止。Docker 幫助系統(tǒng)管理員和程序員在容器中開發(fā)應(yīng)用程序,并且可以擴(kuò)展到成千上萬的節(jié)點(diǎn)。
    2018-03-03
  • Docker服務(wù)器存儲(chǔ)資源池不足的問題解決

    Docker服務(wù)器存儲(chǔ)資源池不足的問題解決

    這篇文章主要給大家介紹了關(guān)于Docker服務(wù)器存儲(chǔ)資源池不足的問題解決方法,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-11-11
  • 繼docker之后podman容器技術(shù)崛起

    繼docker之后podman容器技術(shù)崛起

    這篇文章主要為大家介紹了繼docker之后的podman云原生容器技術(shù)崛起的詳細(xì)介紹,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步
    2022-03-03
  • docker容器內(nèi)缺少命令的簡(jiǎn)單解決辦法

    docker容器內(nèi)缺少命令的簡(jiǎn)單解決辦法

    有時(shí)候在docker容器里面不僅沒有你期望的那些常用的命令,甚至沒有yum命令讓你去安裝那些常用的命令,下面這篇文章主要給大家介紹了關(guān)于docker容器內(nèi)缺少命令的簡(jiǎn)單解決辦法,需要的朋友可以參考下
    2023-03-03
  • 詳解通過Docker搭建Mysql容器+Tomcat容器連接環(huán)境

    詳解通過Docker搭建Mysql容器+Tomcat容器連接環(huán)境

    本篇文章主要介紹了通過Docker搭建Mysql容器+Tomcat容器連接環(huán)境,具有一定的參考價(jià)值,有興趣的可以了解一下。
    2017-01-01
  • 使用Shell腳本批量啟停Docker服務(wù)

    使用Shell腳本批量啟停Docker服務(wù)

    最近日常測(cè)試中經(jīng)常需要手動(dòng)啟動(dòng)或停止docker,于是決定寫一個(gè)Shell腳本來代替人工操作,下面小編把我實(shí)現(xiàn)過程分享到腳本之家平臺(tái),需要的朋友參考下
    2019-11-11
  • 教你使用Docker?Compose一鍵部署前后端分離項(xiàng)目

    教你使用Docker?Compose一鍵部署前后端分離項(xiàng)目

    Compose是一個(gè)定義和管理多容器的工具,使用Python語言編寫,下面這篇文章主要給大家介紹了關(guān)于如何使用Docker?Compose一鍵部署前后端分離項(xiàng)目的相關(guān)資料,需要的朋友可以參考下
    2023-01-01

最新評(píng)論