CentOS8 离线安装 docker-19 tgz版,卸载、启动、停止、自启动

一、说明

docker 一般安装在linux7以上,内核3.1以上。

查看内核

uname -a

lsb_release -a

安装文件:docker-19.03.8.tgz

二、下载地址


tgz
https://download.docker.com/linux/static/stable/x86_64/

rpm
https://download.docker.com/linux/centos/7/x86_64/stable/Packages/

CentOS8 离线安装 docker-19 rpm版,卸载、启动、停止、自启动

https://blog.csdn.net/haveqing/article/details/105277605

三、安装

如果系统上已经有docker了,请先卸载
上传文件,解压

[root@dev1 opt]# tar -xvf docker-19.03.8.tgz
docker/
docker/containerd
docker/docker
docker/ctr
docker/dockerd
docker/runc
docker/docker-proxy
docker/docker-init
docker/containerd-shim

复制

[root@dev1 opt]# cp docker/* /usr/bin/
cp:是否覆盖'/usr/bin/runc'? n

/usr/bin/runc已经有了,两个版本几乎一致,不覆盖了。

RunC 是一个轻量级的工具,它是用来运行容器的,只用来做这一件事,并且这一件事要做好。我们可以认为它就是个命令行小工具,可以不用通过 docker 引擎,直接运行容器。事实上,runC 是标准化的产物,它根据 OCI 标准来创建和运行容器。而 OCI(Open Container Initiative)组织,旨在围绕容器格式和运行时制定一个开放的工业化标准。

四、启动服务

[root@dev1 opt]# dockerd &
[1] 6003
[root@dev1 opt]# INFO[2020-04-01T23:34:33.433691896+08:00] Starting up                                  
WARN[2020-04-01T23:34:33.443186367+08:00] could not change group /var/run/docker.sock to docker: group docker not found 
INFO[2020-04-01T23:34:33.445064754+08:00] libcontainerd: started new containerd process  pid=6012
INFO[2020-04-01T23:34:33.445183491+08:00] parsed scheme: "unix"                         module=grpc
INFO[2020-04-01T23:34:33.445194913+08:00] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2020-04-01T23:34:33.445216241+08:00] ccResolverWrapper: sending update to cc: {[{unix:///var/run/docker/containerd/containerd.sock 0  <nil>}] <nil>}  module=grpc
INFO[2020-04-01T23:34:33.445262282+08:00] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2020-04-01T23:34:33.671535452+08:00] starting containerd                           revision=7ad184331fa3e55e52b890ea95e65ba581ae3429 version=v1.2.13
INFO[2020-04-01T23:34:33.671851863+08:00] loading plugin "io.containerd.content.v1.content"...  type=io.containerd.content.v1
INFO[2020-04-01T23:34:33.671889316+08:00] loading plugin "io.containerd.snapshotter.v1.btrfs"...  type=io.containerd.snapshotter.v1
WARN[2020-04-01T23:34:33.672090098+08:00] failed to load plugin io.containerd.snapshotter.v1.btrfs  error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.btrfs must be a btrfs filesystem to be used with the btrfs snapshotter"
INFO[2020-04-01T23:34:33.672103882+08:00] loading plugin "io.containerd.snapshotter.v1.aufs"...  type=io.containerd.snapshotter.v1
WARN[2020-04-01T23:34:33.677396963+08:00] failed to load plugin io.containerd.snapshotter.v1.aufs  error="modprobe aufs failed: "modprobe: FATAL: Module aufs not found in directory /lib/modules/4.18.0-147.el8.x86_64\n": exit status 1"
INFO[2020-04-01T23:34:33.677434657+08:00] loading plugin "io.containerd.snapshotter.v1.native"...  type=io.containerd.snapshotter.v1
INFO[2020-04-01T23:34:33.677481251+08:00] loading plugin "io.containerd.snapshotter.v1.overlayfs"...  type=io.containerd.snapshotter.v1
INFO[2020-04-01T23:34:33.677540868+08:00] loading plugin "io.containerd.snapshotter.v1.zfs"...  type=io.containerd.snapshotter.v1
INFO[2020-04-01T23:34:33.677769660+08:00] skip loading plugin "io.containerd.snapshotter.v1.zfs"...  type=io.containerd.snapshotter.v1
INFO[2020-04-01T23:34:33.677782571+08:00] loading plugin "io.containerd.metadata.v1.bolt"...  type=io.containerd.metadata.v1
WARN[2020-04-01T23:34:33.677795837+08:00] could not use snapshotter btrfs in metadata plugin  error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.btrfs must be a btrfs filesystem to be used with the btrfs snapshotter"
WARN[2020-04-01T23:34:33.677802593+08:00] could not use snapshotter aufs in metadata plugin  error="modprobe aufs failed: "modprobe: FATAL: Module aufs not found in directory /lib/modules/4.18.0-147.el8.x86_64\n": exit status 1"
WARN[2020-04-01T23:34:33.677808994+08:00] could not use snapshotter zfs in metadata plugin  error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.zfs must be a zfs filesystem to be used with the zfs snapshotter: skip plugin"
INFO[2020-04-01T23:34:33.677936004+08:00] loading plugin "io.containerd.differ.v1.walking"...  type=io.containerd.differ.v1
INFO[2020-04-01T23:34:33.677950514+08:00] loading plugin "io.containerd.gc.v1.scheduler"...  type=io.containerd.gc.v1
INFO[2020-04-01T23:34:33.677969999+08:00] loading plugin "io.containerd.service.v1.containers-service"...  type=io.containerd.service.v1
INFO[2020-04-01T23:34:33.677981803+08:00] loading plugin "io.containerd.service.v1.content-service"...  type=io.containerd.service.v1
INFO[2020-04-01T23:34:33.677990571+08:00] loading plugin "io.containerd.service.v1.diff-service"...  type=io.containerd.service.v1
INFO[2020-04-01T23:34:33.677999652+08:00] loading plugin "io.containerd.service.v1.images-service"...  type=io.containerd.service.v1
INFO[2020-04-01T23:34:33.678008353+08:00] loading plugin "io.containerd.service.v1.leases-service"...  type=io.containerd.service.v1
INFO[2020-04-01T23:34:33.678016718+08:00] loading plugin "io.containerd.service.v1.namespaces-service"...  type=io.containerd.service.v1
INFO[2020-04-01T23:34:33.678024890+08:00] loading plugin "io.containerd.service.v1.snapshots-service"...  type=io.containerd.service.v1
INFO[2020-04-01T23:34:33.678034195+08:00] loading plugin "io.containerd.runtime.v1.linux"...  type=io.containerd.runtime.v1
INFO[2020-04-01T23:34:33.678162352+08:00] loading plugin "io.containerd.runtime.v2.task"...  type=io.containerd.runtime.v2
INFO[2020-04-01T23:34:33.678230678+08:00] loading plugin "io.containerd.monitor.v1.cgroups"...  type=io.containerd.monitor.v1
INFO[2020-04-01T23:34:33.678509190+08:00] loading plugin "io.containerd.service.v1.tasks-service"...  type=io.containerd.service.v1
INFO[2020-04-01T23:34:33.678727862+08:00] loading plugin "io.containerd.internal.v1.restart"...  type=io.containerd.internal.v1
INFO[2020-04-01T23:34:33.678783969+08:00] loading plugin "io.containerd.grpc.v1.containers"...  type=io.containerd.grpc.v1
INFO[2020-04-01T23:34:33.678804751+08:00] loading plugin "io.containerd.grpc.v1.content"...  type=io.containerd.grpc.v1
INFO[2020-04-01T23:34:33.678828618+08:00] loading plugin "io.containerd.grpc.v1.diff"...  type=io.containerd.grpc.v1
INFO[2020-04-01T23:34:33.678846996+08:00] loading plugin "io.containerd.grpc.v1.events"...  type=io.containerd.grpc.v1
INFO[2020-04-01T23:34:33.678870216+08:00] loading plugin "io.containerd.grpc.v1.healthcheck"...  type=io.containerd.grpc.v1
INFO[2020-04-01T23:34:33.678891685+08:00] loading plugin "io.containerd.grpc.v1.images"...  type=io.containerd.grpc.v1
INFO[2020-04-01T23:34:33.678909989+08:00] loading plugin "io.containerd.grpc.v1.leases"...  type=io.containerd.grpc.v1
INFO[2020-04-01T23:34:33.678923911+08:00] loading plugin "io.containerd.grpc.v1.namespaces"...  type=io.containerd.grpc.v1
INFO[2020-04-01T23:34:33.678941090+08:00] loading plugin "io.containerd.internal.v1.opt"...  type=io.containerd.internal.v1
INFO[2020-04-01T23:34:33.679021511+08:00] loading plugin "io.containerd.grpc.v1.snapshots"...  type=io.containerd.grpc.v1
INFO[2020-04-01T23:34:33.679041489+08:00] loading plugin "io.containerd.grpc.v1.tasks"...  type=io.containerd.grpc.v1
INFO[2020-04-01T23:34:33.679058041+08:00] loading plugin "io.containerd.grpc.v1.version"...  type=io.containerd.grpc.v1
INFO[2020-04-01T23:34:33.679072380+08:00] loading plugin "io.containerd.grpc.v1.introspection"...  type=io.containerd.grpc.v1
INFO[2020-04-01T23:34:33.679338801+08:00] serving...                                    address="/var/run/docker/containerd/containerd-debug.sock"
INFO[2020-04-01T23:34:33.679393244+08:00] serving...                                    address="/var/run/docker/containerd/containerd.sock"
INFO[2020-04-01T23:34:33.679409134+08:00] containerd successfully booted in 0.008689s  
INFO[2020-04-01T23:34:33.696700981+08:00] parsed scheme: "unix"                         module=grpc
INFO[2020-04-01T23:34:33.696776193+08:00] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2020-04-01T23:34:33.696797044+08:00] ccResolverWrapper: sending update to cc: {[{unix:///var/run/docker/containerd/containerd.sock 0  <nil>}] <nil>}  module=grpc
INFO[2020-04-01T23:34:33.696805334+08:00] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2020-04-01T23:34:33.698675491+08:00] parsed scheme: "unix"                         module=grpc
INFO[2020-04-01T23:34:33.698731042+08:00] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2020-04-01T23:34:33.698795790+08:00] ccResolverWrapper: sending update to cc: {[{unix:///var/run/docker/containerd/containerd.sock 0  <nil>}] <nil>}  module=grpc
INFO[2020-04-01T23:34:33.698804755+08:00] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2020-04-01T23:34:33.714177526+08:00] [graphdriver] using prior storage driver: overlay2 
WARN[2020-04-01T23:34:33.731535638+08:00] Your kernel does not support cgroup blkio weight 
WARN[2020-04-01T23:34:33.731558253+08:00] Your kernel does not support cgroup blkio weight_device 
INFO[2020-04-01T23:34:33.731800059+08:00] Loading containers: start.                   
INFO[2020-04-01T23:34:33.977253219+08:00] Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address 
INFO[2020-04-01T23:34:34.047328372+08:00] Loading containers: done.                    
INFO[2020-04-01T23:34:34.251673334+08:00] Docker daemon                                 commit=afacb8b7f0 graphdriver(s)=overlay2 version=19.03.8
INFO[2020-04-01T23:34:34.251786767+08:00] Daemon has completed initialization          
INFO[2020-04-01T23:34:34.276319753+08:00] API listen on /var/run/docker.sock

五、测试

[root@dev1 opt]# docker -v
Docker version 19.03.8, build afacb8b7f0
[root@dev1 opt]# docker --version
Docker version 19.03.8, build afacb8b7f0
[root@dev1 opt]# docker version
Client: Docker Engine - Community
 Version:           19.03.8
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        afacb8b7f0
 Built:             Wed Mar 11 01:22:56 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.8
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.17
  Git commit:       afacb8b7f0
  Built:            Wed Mar 11 01:30:32 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          spec: 1.0.1-dev
  GitCommit:        
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

[root@dev1 opt]# docker version
Client: Docker Engine - Community
 Version:           19.03.8
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        afacb8b7f0
 Built:             Wed Mar 11 01:22:56 2020
 OS/Arch:           linux/amd64
 Experimental:      false
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

如果报这句,是dockerd服务没启,启动:dockerd &

六、停止服务

使用kill(这种方式安装的,目前没找到好办法),一般也不用停止

[root@dev1 opt]# ps -ef|grep docker
root       6003   4219  0 23:34 pts/0    00:00:00 dockerd
root       6012   6003  0 23:34 ?        00:00:00 containerd --config /var/run/docker/containerd/containerd.toml --log-level info
root       6225   4219  0 23:41 pts/0    00:00:00 grep --color=auto docker
[root@dev1 opt]# kill 6003 6012
[root@dev1 opt]# INFO[2020-04-01T23:41:53.172475512+08:00] Processing signal 'terminated'               
ERRO[2020-04-01T23:41:53.172744513+08:00] failed to get event                           error="rpc error: code = Unavailable desc = transport is closing" module=libcontainerd namespace=plugins.moby
ERRO[2020-04-01T23:41:53.172840074+08:00] failed to get event                           error="rpc error: code = Unavailable desc = transport is closing" module=libcontainerd namespace=moby
INFO[2020-04-01T23:41:53.173736416+08:00] Daemon shutdown complete                     
INFO[2020-04-01T23:41:53.173768924+08:00] stopping event stream following graceful shutdown  error="context canceled" module=libcontainerd namespace=moby
INFO[2020-04-01T23:41:53.173791963+08:00] stopping event stream following graceful shutdown  error="context canceled" module=libcontainerd namespace=plugins.moby
INFO[2020-04-01T23:41:53.173811088+08:00] stopping healthcheck following graceful shutdown  module=libcontainerd

七、卸载

停止服务,把复制到/usr/bin下的7个文件删除了就可以了。

rm -rf /run/docker

参考:

Linux下离线安装Docker
https://www.cnblogs.com/luoSteel/p/10038954.html

linux如何成功地离线安装docker
https://blog.csdn.net/u011681409/article/details/82695087

官方安装文档

https://docs.docker.com/install/linux/docker-ce/binaries/#install-static-binaries

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值