您的位置:首页 > 运维架构 > Docker

SUSE Linux Enterprise Server 12 使用二进制文件方式快速安装 Docker CE (社区版)

2019-01-29 17:38 776 查看

SUSE Linux Enterprise Server 12 使用二进制文件方式快速安装 Docker CE (社区版)

准备环境

软件包

先检查下系统上以下软件包的版本, 如果版本太低请先使用zypper升级。
64位的LINUX操作系统, 3.10或以上版本的KERNEL(推荐使用最新版本)。

# cat /etc/os-release
dkcdcsapd960:/tmp # cat /etc/os-release
NAME="SLES"
VERSION="12-SP3"
VERSION_ID="12.3"
PRETTY_NAME="SUSE Linux Enterprise Server 12 SP3"
ID="sles"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles:12:sp3"

# uname -a
Linux sles12 4.4.73-5-default #1 SMP Tue Jul 4 15:33:39 UTC 2017 (b7ce4e4) x86_64 x86_64 x86_64 GNU/Linux

iptables 1.4 或以上版本

# rpm -q iptables
iptables-1.4.21-6.1.x86_64

git 1.7 或以上版本

# rpm -q git-core
git-core-2.12.3-27.17.2.x86_64

XZ Utils 4.9 或以上版本

# rpm -q xz
xz-5.0.5-4.852.x86_64

用户与组

新建docker组

# groupadd docker

下载安装

从官网(https://download.docker.com/linux/static/stable/ )下载最新的稳定版。

# cd /tmp
# wget https://download.docker.com/linux/static/stable/x86_64/docker-18.06.1-ce.tgz
--2019-01-29 10:04:21--  https://download.docker.com/linux/static/stable/x86_64/docker-18.06.1-ce.tgz
Resolving download.docker.com (download.docker.com)... 143.204.101.113, 143.204.101.96, 143.204.101.104, ...
Connecting to download.docker.com (download.docker.com)|143.204.101.113|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 43831680 (42M) [application/x-tar]
Saving to: 'docker-18.06.1-ce.tgz'

100%[======================================>] 43,831,680  20.4MB/s   in 2.0s

2019-01-29 10:04:24 (20.4 MB/s) - 'docker-18.06.1-ce.tgz' saved [43831680/43831680]

解压缩下载的压缩包

# tar xzvf docker-18.06.1-ce.tgz
docker/
docker/docker-containerd
docker/docker-proxy
docker/docker
docker/docker-runc
docker/dockerd
docker/docker-containerd-ctr
docker/docker-containerd-shim
docker/docker-init

将解压后 /tmp/docker 路径下的所有文件复制到 /usr/bin/

# cp docker/* /usr/bin/

启动dockerd守护进程

# dockerd &
INFO[2019-01-29T10:09:39.650923149+01:00] libcontainerd: started new docker-containerd process  pid=30229
INFO[2019-01-29T10:09:39.651020621+01:00] parsed scheme: "unix"                         module=grpc
INFO[2019-01-29T10:09:39.651029287+01:00] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2019-01-29T10:09:39.651092304+01:00] ccResolverWrapper: sending new addresses to cc: [{unix:///var/run/docker/containerd/docker-containerd.sock 0  <nil>}]  module=grpc
INFO[2019-01-29T10:09:39.651107459+01:00] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2019-01-29T10:09:39.651184417+01:00] pickfirstBalancer: HandleSubConnStateChange: 0xc42020cc80, CONNECTING  module=grpc
INFO[0000] starting containerd                           revision=468a545b9edcd5932818eb9de8e72413e616e86e version=v1.1.2
INFO[0000] loading plugin "io.containerd.content.v1.content"...  type=io.containerd.content.v1
INFO[0000] loading plugin "io.containerd.snapshotter.v1.btrfs"...  type=io.containerd.snapshotter.v1
WARN[0000] 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[0000] loading plugin "io.containerd.snapshotter.v1.aufs"...  type=io.containerd.snapshotter.v1
WARN[0000] failed to load plugin io.containerd.snapshotter.v1.aufs  error="modprobe aufs failed: "modprobe: FATAL: Module aufs not found.\n": exit status 1"
INFO[0000] loading plugin "io.containerd.snapshotter.v1.native"...  type=io.containerd.snapshotter.v1
INFO[0000] loading plugin "io.containerd.snapshotter.v1.overlayfs"...  type=io.containerd.snapshotter.v1
INFO[0000] loading plugin "io.containerd.snapshotter.v1.zfs"...  type=io.containerd.snapshotter.v1
WARN[0000] failed to load plugin io.containerd.snapshotter.v1.zfs  error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.zfs must be a zfs filesystem to be used with the zfs snapshotter"
INFO[0000] loading plugin "io.containerd.metadata.v1.bolt"...  type=io.containerd.metadata.v1
WARN[0000] 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[0000] could not use snapshotter aufs in metadata plugin  error="modprobe aufs failed: "modprobe: FATAL: Module aufs not found.\n": exit status 1"
WARN[0000] 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"
INFO[0000] loading plugin "io.containerd.differ.v1.walking"...  type=io.containerd.differ.v1
INFO[0000] loading plugin "io.containerd.gc.v1.scheduler"...  type=io.containerd.gc.v1
INFO[0000] loading plugin "io.containerd.service.v1.containers-service"...  type=io.containerd.service.v1
INFO[0000] loading plugin "io.containerd.service.v1.content-service"...  type=io.containerd.service.v1
INFO[0000] loading plugin "io.containerd.service.v1.diff-service"...  type=io.containerd.service.v1
INFO[0000] loading plugin "io.containerd.service.v1.images-service"...  type=io.containerd.service.v1
INFO[0000] loading plugin "io.containerd.service.v1.leases-service"...  type=io.containerd.service.v1
INFO[0000] loading plugin "io.containerd.service.v1.namespaces-service"...  type=io.containerd.service.v1
INFO[0000] loading plugin "io.containerd.service.v1.snapshots-service"...  type=io.containerd.service.v1
INFO[0000] loading plugin "io.containerd.monitor.v1.cgroups"...  type=io.containerd.monitor.v1
INFO[0000] loading plugin "io.containerd.runtime.v1.linux"...  type=io.containerd.runtime.v1
INFO[0000] loading plugin "io.containerd.service.v1.tasks-service"...  type=io.containerd.service.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.containers"...  type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.content"...  type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.diff"...  type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.events"...  type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.healthcheck"...  type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.images"...  type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.leases"...  type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.namespaces"...  type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.snapshots"...  type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.tasks"...  type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.version"...  type=io.containerd.grpc.v1
INFO[0000] loading plugin "io.containerd.grpc.v1.introspection"...  type=io.containerd.grpc.v1
INFO[0000] serving...                                    address="/var/run/docker/containerd/docker-containerd-debug.sock"
INFO[0000] serving...                                    address="/var/run/docker/containerd/docker-containerd.sock"
INFO[0000] containerd successfully booted in 0.012732s
INFO[2019-01-29T10:09:39.702332858+01:00] pickfirstBalancer: HandleSubConnStateChange: 0xc42020cc80, READY  module=grpc
INFO[2019-01-29T10:09:39.786387414+01:00] parsed scheme: "unix"                         module=grpc
INFO[2019-01-29T10:09:39.786425224+01:00] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2019-01-29T10:09:39.786483437+01:00] ccResolverWrapper: sending new addresses to cc: [{unix:///var/run/docker/containerd/docker-containerd.sock 0  <nil>}]  module=grpc
INFO[2019-01-29T10:09:39.786503745+01:00] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2019-01-29T10:09:39.786557066+01:00] pickfirstBalancer: HandleSubConnStateChange: 0xc42020d580, CONNECTING  module=grpc
INFO[2019-01-29T10:09:39.786753138+01:00] pickfirstBalancer: HandleSubConnStateChange: 0xc42020d580, READY  module=grpc
INFO[2019-01-29T10:09:39.847244283+01:00] Graph migration to content-addressability took 0.00 seconds
WARN[2019-01-29T10:09:39.847501477+01:00] Your kernel does not support swap memory limit
WARN[2019-01-29T10:09:39.847529720+01:00] Your kernel does not support kernel memory limit
INFO[2019-01-29T10:09:39.847928380+01:00] parsed scheme: "unix"                         module=grpc
INFO[2019-01-29T10:09:39.847950937+01:00] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2019-01-29T10:09:39.848001797+01:00] ccResolverWrapper: sending new addresses to cc: [{unix:///var/run/docker/containerd/docker-containerd.sock 0  <nil>}]  module=grpc
INFO[2019-01-29T10:09:39.848021199+01:00] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2019-01-29T10:09:39.848067619+01:00] pickfirstBalancer: HandleSubConnStateChange: 0xc420181e50, CONNECTING  module=grpc
INFO[2019-01-29T10:09:39.848227776+01:00] pickfirstBalancer: HandleSubConnStateChange: 0xc420181e50, READY  module=grpc
INFO[2019-01-29T10:09:39.848259624+01:00] Loading containers: start.
INFO[2019-01-29T10:09:40.041625525+01: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[2019-01-29T10:09:40.106902974+01:00] Loading containers: done.
INFO[2019-01-29T10:09:40.138272342+01:00] Docker daemon                                 commit=e68fc7a graphdriver(s)=overlay2 version=18.06.1-ce
INFO[2019-01-29T10:09:40.138381701+01:00] Daemon has completed initialization
INFO[2019-01-29T10:09:40.191708248+01:00] API listen on /var/run/docker.sock

验证安装

查看docker 运行状态

# docker info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 18.06.1-ce
Storage Driver: overlay2
Backing Filesystem: xfs
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 logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 468a545b9edcd5932818eb9de8e72413e616e86e
runc version: 69663f0bd4b60df09991c08812a60108003fa340
init version: fec3683
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.4.73-5-default
Operating System: SUSE Linux Enterprise Server 12 SP3
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 62.92GiB
Name: dkcdcsapd960
ID: XPOL:QQ5Y:ZELA:ZMW5:NTZV:MK2X:NLVS:EYUA:56FQ:7T23:C4JE:Y7CW
Docker Root Dir: /var/lib/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

WARNING: No swap limit support
WARNING: No kernel memory limit support

执行 hello-world 镜像来验证安装是否成功。 执行命令后docker将自动从docker hub上下载镜像并执行。

# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:2557e3c07ed1e38f26e389462d03ed943586f744621577a99efb77324b0fe535
Status: Downloaded newer image for hello-world:latest
INFO[0148] shim docker-containerd-shim started           address="/containerd-shim/moby/33c8fde33e0995ebce5e93fbc54c190705ec82c829958095e4c5e76ab1987dcf/shim.sock" debug=false pid=30481

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/

INFO[0149] shim reaped                                   id=33c8fde33e0995ebce5e93fbc54c190705ec82c829958095e4c5e76ab1987dcf
INFO[2019-01-29T10:12:08.738899072+01:00] ignoring event                                module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"

参考官网文档

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

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: