CentOS8 RPM 包安装 Docker环境

亡羊补牛
亡羊补牛 2019-09-25 11:12
阅读需:0

   不知道什么原因我浏览器打开乱码,MD文档上传个附件:

CentOS8-Docker.md

 


       因为CentOS8 美国时间9月24日凌晨发布,国内镜像同步时间在9月25日凌晨前后,很多开发中需要的环境还没有现成的包,需要手动安装,此安装方式在 CentOS8 最小安装环境下测试通过。

Docker 卸载老版本(如果安装出错可以执行,否则忽略)

$ sudo yum remove docker \
                 docker-client \
                 docker-client-latest \
                 docker-common \
                 docker-latest \
                 docker-latest-logrotate \
                 docker-logrotate \
                 docker-engine

安装依赖包

$ sudo yum install -y yum-utils \
 device-mapper-persistent-data \
 container-selinux \
 libcgroup \
 lvm2

## 手动安装RPM,使用阿里云镜像仓库

rpm -ivh https://mirrors.aliyun.com/docker-ce/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm
rpm -ivh https://mirrors.aliyun.com/docker-ce/linux/centos/7/x86_64/stable/Packages/docker-ce-19.03.2-3.el7.x86_64.rpm
rpm -ivh
https://mirrors.aliyun.com/docker-ce/linux/centos/7/x86_64/stable/Packages/docker-ce-cli-19.03.2-3.el7.x86_64.rpm
# docker info
Client:
Debug Mode: false

Server:
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 19.03.2
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 ipvlan macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc version: 425e105d5a03fabd737a126ad93d62a9eeede87f
init version: fec3683
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.18.0-80.7.1.el8_0.x86_64
Operating System: CentOS Linux 8 (Core)
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 2.782GiB
Name: sharpox.cc
ID: M4QQ:GQQL:WLUZ:3ERV:EUDF:TF3Z:GM5D:ZFBD:CI5I:54UP:FL3Z:LDG4
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

Docker

安装成功,下面安装docker-compose

curl -L https://github.com/docker/compose/releases/download/1.25.0-rc2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

测试是否安装成功

[root@~]# docker-compose -v
docker-compose version 1.25.0-rc2, build 661ac20e

安装成功!

设置docker国内加速器

  • 国内阿里云提供的镜像服务


  • 也可以设置你自己的私服代理服务器或者docker cn提供的国内镜像

登录docker服务器,这个是push镜像到docker hub需要的

[root@ ~]# docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: username
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded

显示登陆成功,docker + docker-compose 在 centos8 下的环境搭建完成。


评论
  • 消灭零回复