首页 > 系统相关 >第三十五章 Centos7下rpm安装Docker-17.03

第三十五章 Centos7下rpm安装Docker-17.03

时间:2022-10-20 11:22:38浏览次数:51  
标签:ftp cos root data Centos7 17.03 docker rpm Docker

一、安装依赖

[root@cos-ftp ~]# sudo yum install libxml2-devel libcurl-devel -y

二、下载Docker安装包

# 1.下载地址:https://download.docker.com/linux/centos/7/x86_64/stable/Packages/
# 2.下载rpm包:
docker-ce-17.03.0.ce-1.el7.centos.x86_64.rpm 
docker-ce-selinux-17.03.0.ce-1.el7.centos.noarch.rpm   

三、上传Docker安装包

# 1.新建docker安装包存放目录
[root@cos-ftp ~]# mkdir -p docker
[root@cos-ftp ~]# cd docker/

# 2.上传安装包
[root@cos-ftp docker]# rz

# 3.查看安装包
[root@cos-ftp docker]# ll
总用量 19096
-rw-r--r-- 1 root root 19521288 10月 15 14:21 docker-ce-17.03.0.ce-1.el7.centos.x86_64.rpm
-rw-r--r-- 1 root root    29108 10月 15 14:21 docker-ce-selinux-17.03.0.ce-1.el7.centos.noarch.rpm

四、安装Docker

[root@cos-ftp docker]# yum -y install *.rpm

五、修改Docker数据目录

# 1.新建Docker数据存放目录
[root@cos-ftp docker]# mkdir -p /data/docker

# 2.修改Docker启动文件
[root@cos-ftp docker]# vim /usr/lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network.target firewalld.service

[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd --graph=/data/docker
ExecReload=/bin/kill -s HUP $MAINPID
# 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=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process

[Install]
WantedBy=multi-user.target

六、启动Docker

# 1.重载system
[root@cos-ftp docker]# sudo systemctl daemon-reload

# 2.启动Docker
[root@cos-ftp docker]# sudo systemctl restart docker

七、验证Docker

# 1.查看Docker服务状态
[root@cos-ftp docker]# sudo systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: active (running) since 六 2022-10-15 15:30:41 CST; 1 day 18h ago
     Docs: https://docs.docker.com
 Main PID: 16116 (dockerd)
    Tasks: 37
   Memory: 550.8M
   CGroup: /system.slice/docker.service
           ├─16116 /usr/bin/dockerd --graph=/data/docker
           ├─16121 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --...
           ├─16524 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8080 -container-ip 172...
           └─16529 docker-containerd-shim c31c854131acff255ac6c3b562d2ce32cae6470b1c45656a9b5cbf000134...
           
# 2.验证Docker数据目录及版本
[root@cos-ftp docker]# docker info |grep -E 'Server Version|Docker Root Dir'
Server Version: 17.03.0-ce
Docker Root Dir: /data/docker

八、上传镜像到服务器

1.下载镜像包

镜像包地址:https://activity-dev-1255598736.cos.ap-guangzhou.myqcloud.com/cos-csi-image/caas-file-script-1.0.tar?q-sign-algorithm=sha1&q-ak=AKID1kpH1OJFFzLEwFVlqEvn4YdOCZ2WoYyC2bo1ejoVPz48Pm7OlL5J_mJc2iz_MYax&q-sign-time=1665991787;1665995387&q-key-time=1665991787;1665995387&q-header-list=host&q-url-param-list=&q-signature=12dfec0ac82a6a6266f2dc12ca8c41d718ae27b0&x-cos-security-token=***************

2.上传镜像

[root@cos-ftp ~]# rz
[root@cos-ftp ~]# ll
总用量 2968316
-rw-r--r-- 1 root root  841987072 10月 17 15:32 caas-file-script-1.0.tar

3.加载镜像

# 1.加载caas-file-script-1.0.tarr镜像
[root@cos-ftp ~]# docker load -i caas-file-script-1.0.tar
612be2c668b1: Loading layer 320.7 MB/320.7 MB
7d01265ad2ea: Loading layer 3.584 kB/3.584 kB
f37f0c4b685f: Loading layer 343.3 MB/343.3 MB
47d2f607eb5d: Loading layer 48.83 MB/48.83 MB
31336b7d6b01: Loading layer 4.096 kB/4.096 kB
Loaded image ID: sha256:eee591c193605078f0ef9fb9b8c1c4a2c7bd577c72cd2c86c4a0f518f9ba2b4e

# 2.查看镜像
[root@cos-ftp ~]# docker images
REPOSITORY                             TAG                 IMAGE ID            CREATED             SIZE
<none>                                 <none>              eee591c19360        About an hour ago   826 MB

# 3.打上原始镜像标签
[root@cos-ftp ~]# docker tag eee591c19360 caas-file-script-202210171124:latest

# 4.再次查看镜像
[root@cos-ftp ~]# docker images
REPOSITORY                             TAG                 IMAGE ID            CREATED             SIZE
caas-file-script-202210171124          latest              eee591c19360        About an hour ago   826 MB

九、运行Docker

1.运行Docker容器

[root@cos-ftp ~]# docker run \
 -itd  \
 -v /data/cos/prod/release_data:/data/cos \
 -v /data/cos_ftp:/data/cos_ftp \
 -v /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime \
 --restart always \
 --privileged=true \
 --name caas-file-script \
 caas-file-script-202210171124:latest
 8075d3870807b11cc138fd42c441e2306149fe95f6e9b932d7533f1ab2ce8377

2.查看容器

[root@cos-ftp ~]# docker ps
CONTAINER ID        IMAGE                                  COMMAND                  CREATED             STATUS              PORTS               NAMES
8075d3870807        caas-file-script-202210171124:latest   "/data/FileBufferZ..."   11 seconds ago      Up 8 seconds                            caas-file-script

3.检查容器目录

[root@cos-ftp ~]# docker exec -it 8075d3870807 /bin/bash

root@8075d3870807:/# df -h
Filesystem                 Size  Used Avail Use% Mounted on
overlay                    483G  2.4G  456G   1% /
tmpfs                      1.9G     0  1.9G   0% /dev
tmpfs                      1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/mapper/datavg-datalv  483G  2.4G  456G   1% /data/cos_ftp
/dev/mapper/centos-root     50G  5.5G   45G  11% /usr/share/zoneinfo/Asia/Shanghai
cosfs                      256T     0  256T   0% /data/cos
shm                         64M     0   64M   0% /dev/shm

标签:ftp,cos,root,data,Centos7,17.03,docker,rpm,Docker
From: https://www.cnblogs.com/jhno1/p/16809091.html

相关文章

  • centos8-stream下用rpm包安装ipmitool
    首先准备一个U盘,格式化成:FAT32接着下载:ipmitool.rpm,放进U盘然后插入服务器fdisk-l#显示当前分区情况mkdir-p/mnt/usb#创建文件夹当作挂载点mount/de......
  • rpm -Uvh *.rpm --nodeps --force
    rpm-Uvh*.rpm--nodeps--force含义:-U:升级软件,若未软件尚未安装,则安装软件。-v:表示显示详细信息。-h:以"#"号显示安装进度。--force:强制安装--nodeps:不考虑相依属性的关......
  • centos 7 安装mysql 5.7失败 出现 Retrieving key from file:///etc/pki/rpm-gpg/RPM-
    Publickeyformysql-community-common-5.7.40-1.el7.x86_64.rpmisnotinstalled(1/5):mysql-community-common-5.7.40-1.el7.x86_64.rpm|311kB00:01......
  • CentOS7 安装FTP Server
    1.安装FTPServeryum-yinstallvsftpdsystemctlstartvsftpd.servicesystemctlenablevsftpd.service2.新建用户和FTP目录groupaddftp#指定用户主目录:/data/......
  • centos7环境下二进制编译安装ffmpeg
    centos7环境下二进制编译安装ffmpeg mkdir-p/usr/local/src/ffmpeg_sourcescd/usr/local/src/ffmpeg_sources#安装nasmcd/usr/local/src/ffmpeg_sourcescurl......
  • CentOS7更改yum源
    1进入yum.repos.d cd/etc/yum.repos.d/2删除当前目录yum.repos.d下的所有文件(建议先备份)3阿里云yum源安装 curl-o/etc/yum.repos.d/CentOS-Base.repohttp://m......
  • centos7离线安装Jenkins-rpm方式
    Jenkins有多种安装方式,下面通过rpm进行安装前提:Java的jdk已安装一、下载Jenkins的rpm包下载地址:https://jenkins.io/zh/download/或者https://mirrors.tuna.tsinghua.edu......
  • ansible rpm包下载
    Ansible2.9.18版本下载链接:https://pan.baidu.com/s/1dKlwtLWSOKoMkanW900n9Q 提取码:ansi将软件上传至系统并解压安装:#tar-zxvfansible_2.9.18.tar.gz#cdansible......
  • centos7安装redis6.2
    一、下载安装包[root@glusterfs03~]#wgethttps://download.redis.io/releases/redis-6.2.7.tar.gz--2022-10-1810:35:21--https://download.redis.io/releas......
  • centos7中如何关闭、启动防火墙
     001、查看防火墙状态systemctlstatusfirewalld  002、关闭防火墙systemctlstopfirewalld 003、查看关闭防火墙状态systemctlstatusfirewalld......