以下命令可以在root身份下保存为shell脚本直接bash一次性执行

参考:

https://yeasy.gitbooks.io/docker_practice/install/centos.html

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

http://www.ruanyifeng.com/blog/2018/02/docker-tutorial.html

#以下所有操作需以root身份执行
#去除本系统中所有可能的无效依赖
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine
#安装依赖
yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
#在中国国内的话设置docker源为中国科技大学镜像
yum-config-manager \
--add-repo \
https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo
#更新yum缓存
yum makecache fast
#安装docker-ce(社区版)
yum install docker-ce
#启动服务
systemctl enable docker
systemctl start docker
#建立docker用户组(组名可自定义)
groupadd docker-tz
#以root身份将一个普通帐户加入新的用户组(切勿将root用户加入组)
usermod -aG docker-tz tuzhuo
#以root身份运行测试程序
docker run hello-world
# 若能输出以下信息则本系统docker服务部署成功
# Unable to find image 'hello-world:latest' locally
# latest: Pulling from library/hello-world
# d1725b59e92d: Pull complete
# Digest: sha256:0add3ace90ecb4adbf7777e9aacf18357296e799f81cabc9fde470971e499788
# Status: Downloaded newer image for hello-world:latest # 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/

tz@croplab,hzau

2019/9/28

CentOS7 docker服务部署的更多相关文章

  1. centos7后台服务部署jar包

    centos7 服务部署jar包 centos7 服务介绍 CentOS7的服务systemctl脚本存放在:/usr/lib/systemd/,有系统(system)和用户(user)之分, 每一个 ...

  2. docker服务部署、迁移与备份、dockerfile、私有仓库

    今日内容概要 服务部署 迁移与备份 dockerfile 私有仓库 内容详细 1.服务部署 # 装 mysql redis --->源码编译安装-->启 动 # 有了docker后,容器操 ...

  3. centos7+ docker 实践部署docker及配置direct_lvm

    转载于博客园:http://www.cnblogs.com/Andrew-XinFei/p/6245330.html 前言 Docker现在在后端是那么的火热..尤其当笔者了解了docker是什么.能 ...

  4. CentOS7 Docker容器无法ping通宿主机ip问题解决记录

    Docker服务部署启动容器发现docker容器内访问宿主机IP不通,于是进入容器内ping宿主机IP,发现无法ping通,容器IP为172.17.0.2,于是继续ping172.17.0.1也不通, ...

  5. docker微服务部署之:六、Rancher管理部署微服务

    docker微服务部署之:五.利用DockerMaven插件自动构建镜像 一. 什么是Rancher Rancher是一个开源的企业级容器管理平台.通过Rancher,企业再也不必自己使用一系列的开源 ...

  6. docker微服务部署之:五、利用DockerMaven插件自动构建镜像

    docker微服务部署之:四.安装docker.docker中安装mysql和jdk1.8.手动构建镜像.部署项目 在上一篇文章中,我们是手动构建镜像,即: 4.1.2.5.1.2.6.1.2中的将d ...

  7. docker微服务部署之:四、安装docker、docker中安装mysql和jdk1.8、手动构建镜像、部署项目

    docker微服务部署之:三,搭建Zuul微服务项目 1.Centos7安装Docker 详见:Centos7安装Docker 2.Docker中安装jdk1.8 详见:使用Docker构建jdk1. ...

  8. docker微服务部署之:二、搭建文章微服务项目

    docker微服务部署之:一,搭建Eureka微服务项目 一.新增demo_article模块,并编写代码 右键demo_parent->new->Module->Maven,选择M ...

  9. docker容器化python服务部署(supervisor-gunicorn-flask)

    docker容器化python服务部署(supervisor-gunicorn-flask) 本文系作者原创,转载请注明出处: https://www.cnblogs.com/further-furt ...

随机推荐

  1. Java: For循环那些事

    title: Java-for循环那些事 toc: true date: 2019-05-21 10:28:44 categories: Java tags: - Tips --- Java for循 ...

  2. Java学习笔记【九、集合框架】

    集合框架设计的目标: 高性能. 允许不同类型的集合,以类似的方式工作,有互操作性. 对一个集合的扩展和适应必须简单. 集合框架包含: 接口:代表集合的抽象数据类型. 实现(类):具体实现(ArrayL ...

  3. NORDIC GATT事件

    假设有两个服务,每个服务注册相应事件 注册的事件为ble_dev_cfg_on_ble_evt.ble_lora_cfg_on_ble_evt 当在任何一个服务中发生GATT特征读或写的时候,注册的这 ...

  4. Python lambda 知识点

    作者说学会了lambda后,你会用上瘾的,因为让代码复用和简洁. 初识lamdba不太好理解,尤其是它能当着一个变量传递给函数,不过多学着写几个例子就好了,下面是我的学习笔记. lambda 操作符( ...

  5. Keepalived + Haproxy + PXC 理论篇

    最终模型: 将Kp1 + Kp2 分别和Ha1和Ha2部署在一起,同时绑定VIP ip,对外提供访问,同时监控本机的Haproxy的可用性 通过Ha1 + Ha2 为PXC提供负载均衡,分发请求到后端 ...

  6. PXE+Kickstart实现批量化无人值守安装

    centos7下进行kickstart配置 配置kickstart时需要pxe芯片,为获取ip地址 1.先安装dhcpd服务器 yum install -y dhcpd 1-1.配置dhcp的配置文件 ...

  7. PAT Basic 1051 复数乘法 (15 分)

    复数可以写成 ( 的常规形式,其中 A 是实部,B 是虚部,i 是虚数单位,满足 1:也可以写成极坐标下的指数形式 (,其中 R 是复数模,P 是辐角,i 是虚数单位,其等价于三角形式 (. 现给定两 ...

  8. Tunnel Warfare HDU - 1540 (线段树处理连续区间问题)

    During the War of Resistance Against Japan, tunnel warfare was carried out extensively in the vast a ...

  9. python 示例代码1

    第一章 python基础一 ​在此不再赘述为什么学习python这门编程,网上搜索一箩筐.我在此仅说一句python的好,用了你就会爱上它. 本python示例代码1000+带你由浅入深的了解pyth ...

  10. GitChat·人工智能 | 除了深度学习,机器翻译还需要啥?

    本文开始要写作的时候,翻译圈里出了一个“爆炸性”的事件.6月27日下午,一个同传译员在朋友圈里爆料:某AI公司请这位译员去“扮演”机器同传,制造人工智能取代人工同传的“震撼”效果. 这个事件瞬间在译员 ...