首页 > 系统相关 >centos离线安装docker

centos离线安装docker

时间:2023-02-16 10:55:28浏览次数:52  
标签:00 centos 54 离线 version dockerd docker localhost

转载自:https://blog.csdn.net/weixin_45107899/article/details/125503680

===========================


一、步骤
1. 安装包官方地址:https://download.docker.com/linux/static/stable/x86_64/

选择18.06.3-ce


2.解压
3.将解压出来的docker文件复制到 /usr/bin/ 目录下
4.进入/etc/systemd/system/目录,并创建docker.service文件,内容如下,这样可以将docker注册为service服务
5.启动docker
6.docker环境检查


一、步骤
1. 安装包官方地址:https://download.docker.com/linux/static/stable/x86_64/
可以先下载到本地,然后通过ftp工具上传到服务器上,或者在服务器上使用命令下载

wget https://download.docker.com/linux/static/stable/x86_64/docker-18.06.3-ce.tgz


2.解压
代码如下(示例):

tar -zxvf docker-18.06.3-ce.tgz

 

3.将解压出来的docker文件复制到 /usr/bin/ 目录下
代码如下(示例):

cp docker/* /usr/bin/

 

4.进入/etc/systemd/system/目录,并创建docker.service文件,内容如下,这样可以将docker注册为service服务
代码如下(示例):

[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target

[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 --selinux-enabled=false --insecure-registry=127.0.0.1
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
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s

[Install]
WantedBy=multi-user.target

 

此处的–insecure-registry=127.0.0.1(此处改成你私服ip)设置是针对有搭建了自己私服Harbor时允许docker进行不安全的访问,否则访问将会被拒绝。

 

5.启动docker
给docker.service文件添加执行权限

chmod +x /etc/systemd/system/docker.service

 

重新加载配置文件(每次有修改docker.service文件时都要重新加载下)

systemctl daemon-reload

 

启动

systemctl start docker

 

设置开机启动

systemctl enable docker.service

 

查看docker服务状态

[root@localhost system]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/etc/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2022-06-28 00:54:47 PDT; 10s ago
Docs: https://docs.docker.com
Main PID: 45475 (dockerd)
CGroup: /system.slice/docker.service
├─45475 /usr/bin/dockerd --selinux-enabled=false --insecure-registry=10.1.20.150
└─45487 containerd --config /var/run/docker/containerd/containerd.toml --log-level info

Jun 28 00:54:46 localhost.localdomain dockerd[45475]: time="2022-06-28T00:54:46.158519178-07:00" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///var/run/docker/containerd..." module=grpc
Jun 28 00:54:46 localhost.localdomain dockerd[45475]: time="2022-06-28T00:54:46.158525449-07:00" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
Jun 28 00:54:46 localhost.localdomain dockerd[45475]: time="2022-06-28T00:54:46.202943588-07:00" level=info msg="Loading containers: start."
Jun 28 00:54:47 localhost.localdomain dockerd[45475]: time="2022-06-28T00:54:47.021854086-07:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon...d IP address"
Jun 28 00:54:47 localhost.localdomain dockerd[45475]: time="2022-06-28T00:54:47.126281901-07:00" level=info msg="Firewalld: interface docker0 already part of docker zone, returning"
Jun 28 00:54:47 localhost.localdomain dockerd[45475]: time="2022-06-28T00:54:47.244251569-07:00" level=info msg="Loading containers: done."
Jun 28 00:54:47 localhost.localdomain dockerd[45475]: time="2022-06-28T00:54:47.264592112-07:00" level=info msg="Docker daemon" commit=a89b842 graphdriver(s)=overlay2 version=20.10.17
Jun 28 00:54:47 localhost.localdomain dockerd[45475]: time="2022-06-28T00:54:47.265027319-07:00" level=info msg="Daemon has completed initialization"
Jun 28 00:54:47 localhost.localdomain systemd[1]: Started Docker Application Container Engine.
Jun 28 00:54:47 localhost.localdomain dockerd[45475]: time="2022-06-28T00:54:47.300116789-07:00" level=info msg="API listen on /var/run/docker.sock"
Hint: Some lines were ellipsized, use -l to show in full.

 

上图表示docker已安装成功

6.docker环境检查
docker info

[root@localhost system]# [root@localhost system]# docker info
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 20.10.17
Storage Driver: overlay2
Backing Filesystem: xfs
Supports d_type: true
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
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-693.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.624GiB
Name: localhost.localdomain
ID: ZHES:U53P:FOPX:QKRO:4PQE:BIKC:OEQJ:7VUS:NBUQ:U47D:R3QO:JKKX
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
10.1.20.150
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

 

docker version

[root@localhost system]# docker version
Client:
Version: 20.10.17
API version: 1.41
Go version: go1.17.11
Git commit: 100c701
Built: Mon Jun 6 22:56:42 2022
OS/Arch: linux/amd64
Context: default
Experimental: true

Server: Docker Engine - Community
Engine:
Version: 20.10.17
API version: 1.41 (minimum version 1.12)
Go version: go1.17.11
Git commit: a89b842
Built: Mon Jun 6 23:01:45 2022
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.6.6
GitCommit: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
runc:
Version: 1.1.2
GitCommit: v1.1.2-0-ga916309f
docker-init:
Version: 0.19.0
GitCommit: de40ad0

 

标签:00,centos,54,离线,version,dockerd,docker,localhost
From: https://www.cnblogs.com/hd92/p/17125928.html

相关文章

  • 记录一次线上docker排查服务cpu过高的操作
    线上CPU飙升,排查问题docker运行的mysql要在容器内找到线程ID进入docker容器dockerexec-it 容器IDbash容器内没有top命令,基于centos安装apt-getupdateapt-get......
  • Centos7配置fstp
    Centos7配置fstp1创建用户  useradd-m-d/data/sftp_data/user1-s/usr/sbin/nologin-gsftpuser1-m:自动创建home目录-d:指定home目录为/data/sftp......
  • docker 运行后端项目出错,查看日志,错误信息为:Error: Unable to access jarfile /xxx
    原因:创建镜像时使用的Dockerfile里的jar包路径与宿主机目录映射路径不一致Dockerfile中:ENTRYPOINT["java","-jar","/temp/yudao-server.jar","--spring.config.a......
  • CentOS 安装 SNAP
    一、CentOS71.安装(1)安装epel库sudoyuminstallepel-release-y(2)安装yum插件coprsudoyuminstallyum-plugin-copr-y(3)添加仓库sudoyumcopren......
  • Centos7.5 安装 docker
    仅供学习笔记记录卸载老版本yumremovedockerdocker-commoncontainer-selinuxdocker-selinuxdocker-engine更新yumyumupdate安装yum-utils,它提供了yum-co......
  • 使用Docker启动并运行Redis
    1.拉取redis镜像#拉取redis镜像dockerpullredis#查看镜像dockerimages2.Redis相关的配置创建挂载目录以及获取redis.conf配置文件1.创建挂载目录......
  • 【解决方案】docker: Error response from daemon: endpoint with name nacos already
    问题描述修改nacos配置时,保存报错于是重启nacos,nacos使用Docker部署。重启nacos容器时,遇到如下问题:[root@localhost~]#dockerstartb7236a0545a3Errorrespons......
  • dockerfile
    DockerfileDockerfileFROMubuntu:22.04-----------------------------------安装cmake-------------------------------------->>ADDhttps://cmake.org/files/v3.......
  • 极兔一面:Dockerfile如何优化?注意:千万不要只说减少层数
    文章持续更新,建议收藏起来,慢慢读!疯狂创客圈总目录博客园版为您奉上珍贵的学习资源:免费赠送:《尼恩Java面试宝典》持续更新+史上最全+面试必备2000页+面试必备+......
  • CentOS里配置.net core运行环境
    CentOS里配置.netcore运行环境(含后台运行,附ssh长连接)说明:2带了4(vs2017仅支持2.1,命令中修改版本就好)另外,2.1、3.1等版本可以共存,不影响使用1注册Microsoft......