centos7.x docker安装及配置,持续更新
1. 安装docker-ce [root],ce为docker社区版,免费,ee版为企业版,收费
列出所有已安装docker
# rpm -qa | grep docker
删除已安装docker
# rpm -e rpmname
安装docker-ce
# yum install docker-ce.x86_64 # 此命令会自动安装相关依赖包
配置Daocloud加速
# curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://8ad7943c.m.daocloud.io
2. 开启dock服务,并设置开机自启 [root]
# systemctl start docker
# systemctl enable docker.service
3. 测试docker [root]
# docker run hello-world # 会弹出如下信息,说明安装成功
Hello from Docker!
This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps:
. The Docker client contacted the Docker daemon.
. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
. 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://cloud.docker.com/ For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
# docker info #此命令可以查看dock内image和container信息
4. 使特定普通用户可以执行dock命令 [root]
# visudo
在最下方加入此行,此行会允许特定用户以sudo方式运行docker,第一次运行时要求输入该特定用户的密码,以后每隔5分钟重复运行docker命令时需要输入密码:
#docker
username ALL=(ALL) /usr/bin/docker
下面这行的区别在于,不需要输入sudo密码,但是并不安全
#docker
username ALL=(ALL) NOPASSWD: /usr/bin/docker
设置/usr/bin/docker别名
# alias docker="sudo /usr/bin/docker"
直接在命令行输入上述命令时,此命令不会永久生效,如果想永久生效,将其加入对应用户的.bashrc中即可
vim ~/.bashrc
# .bashrc # User specific aliases and functions alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias docker="sudo /usr/bin/docker" # Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
...
5. 测试 [username]
配置完上述命令之后,指定的普通用户就可以直接运行docker命令了
# dock info
参考自:
http://cloud.51cto.com/art/201508/488478.htm
http://www.jianshu.com/p/e9b6f5a6f198
https://segmentfault.com/a/1190000007875949
centos7.x docker安装及配置,持续更新的更多相关文章
- Ubuntu Docker 安装和配置 GitLab CI 持续集成
相关文章: Ubuntu Docker 简单安装 GitLab 劈荆斩棘:Gitlab 部署 CI 持续集成 目的:在 Ubuntu 服务器上,使用 Docker 安装和配置 GitLab Runne ...
- CentOS7利用docker安装MySQL5.7
CentOS7利用docker安装MySQL5.7 前提条件 centos7 且内核版本高于3.10, 可通过以下命令查看内核版本 uname -r 利用yum 安装docker 安装一些必要的系统工 ...
- docker安装与配置gitlab详细过程
docker安装与配置gitlab详细过程 1.打开网易镜像中心 https://c.163yun.com/hub#/m/home/ 2.搜索gitlab,获取下载地址.例如:docker pull ...
- Apache系列:Centos7.2下安装与配置apache
Centos7.2下安装与配置apache(一) 配置机:腾讯云服务器,centos7.2 一.安装Apache服务(Apache软件安装包叫httpd) yum install httpd -y 二 ...
- Docker的安装,配置,更新和卸载
我们可以在Linux中安装Docker并运行Hello world应用程序.通过下面这些操作,我们将会学到更多有关于Docker的基础特征.我们将会学到如何: 安装Docker引擎 在一个容器中运行软 ...
- centos7用docker安装mysql5.7.24后配置主从
1)使用docker安装完成mysql5.7.24,我规划的是3台: 192.168.0.170(Master) 192.168.0.169(Slave) 192.168.0.168(Slave) 2 ...
- Centos7通过Docker安装Sentry(哨兵)
Docker介绍 Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的 Linux 机器上,也可以实现虚拟化.容器是完全使用沙箱机制, ...
- Docker笔记(三):Docker安装与配置
原文地址:http://blog.jboost.cn/2019/07/14/docker-3.html Docker分为Docker CE社区免费版与Docker EE企业收费版.Docker EE主 ...
- Centos7系统Docker安装
目录 前期说明 安装步骤 1.官网中文安装参考手册 2.确定你是CentOS7及以上版本 3.yum安装gcc相关 4.卸载旧版本 5.安装需要的软件包 6.设置stable镜像仓库 7.更新yum软 ...
随机推荐
- POJ-1143(状态压缩)
Number Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3432 Accepted: 1399 Descripti ...
- hdu2243 考研路茫茫——单词情结【AC自动机】【矩阵快速幂】
考研路茫茫——单词情结 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total ...
- 如何选择windows 10 系统中默认打开程序
有时候我们会遇到打开某些文件需要通过open with 选择打开的应用程序,然后再点选always open with. 但是有时候这个方法不起作用,我们可以用如下方法: 1.从settings找到a ...
- .NET Core开发日志——HttpClientFactory
当需要向某特定URL地址发送HTTP请求并得到相应响应时,通常会用到HttpClient类.该类包含了众多有用的方法,可以满足绝大多数的需求.但是如果对其使用不当时,可能会出现意想不到的事情. 博客园 ...
- python基础①
一. Python 命名规范: 1, 变量量由字⺟母, 数字,下划线搭配组合⽽而成 2, 不不可以⽤用数字开头,更更不不能是全数字 3,不能是pythond的关键字, 这些符号和字⺟母已经 ...
- CCPC-Wannafly Winter Camp Day3 Div1 - 石头剪刀布 - [带权并查集]
题目链接:https://zhixincode.com/contest/14/problem/I?problem_id=211 样例输入 1 3 5 2 1 1 2 1 2 1 1 2 3 2 1 ...
- 1 byte 8 bit 1 sh 1 bit 2. 字符与编码在程序中的实现
https://en.wikipedia.org/wiki/Shannon_(unit) 1字节(英语:Byte)=8比特(英语:bit) The shannon (symbol Sh), also ...
- knowledge learning things TODO
加密分区 suricata调研 tor配置 tilda配置 automake / autoconf / libtool 使用 大页内存的深入原理 Memory channels Network Man ...
- 如何通过钉钉扫码登录odoo
更加方便快捷的登录odoo,实现免密码登录,有需要此模块朋友加我微信18310744639 1.首先你需要一个钉钉管理员权限,以便获取appid, appsecret,corpid, corpsecr ...
- 内部排序->选择排序->简单选择排序
文字描述 简单排序的基本思想是:每一趟在n-i+1(i=1,2,…,n)个记录中选取关键字最小的记录作为有序列表中的第i个记录. 示意图 略 算法分析 简单排序算法中,所需进行记录移动的操作次数较少, ...