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软 ...
随机推荐
- Caused by: org.postgresql.util.PSQLException: ERROR: operator does not exist: character varying = integer
Springboot项目,使用postgresql数据库,mybatis做持久层框架, <select id="select" resultMap="BaseRes ...
- Error creating bean with name 'eurekaAutoServiceRegistration'
spring-boot项目不断重启,报错: org.springframework.beans.factory.BeanCreationNotAllowedException: Error creat ...
- 配置hadoop集群,完全分布式模式
[/soft/hadoop/etc/hadoop] [hdfs-site.xml] <configuration> <property> <name>dfs.rep ...
- ElasticSearch入门 第一篇:Windows下安装ElasticSearch
这是ElasticSearch 2.4 版本系列的第一篇: ElasticSearch入门 第一篇:Windows下安装ElasticSearch ElasticSearch入门 第二篇:集群配置 E ...
- Entity Framework 6如何进行导航属性的筛选(context.Msg.First(t=>t.Id==1).Include(t=>t.MsgDetail),筛选MsgDetail带条件)
问题: https://q.cnblogs.com/q/98333/ Msg表(Id,Content,IsDel).内有 virtual ICollection<MsgDetail> Ms ...
- python内置函数,lambda表达式,文件读写
Lambda表达式: lambda是个匿名函数,自动加return返回 a={ 6:2,8:0, 1:4,-5:6,99:11,4:22} print(sorted(a.items()))#按key排 ...
- PSU/OPATCH/OJVM下载页面及安装方式(最实用版)
中文版:数据库 PSU,SPU(CPU),Bundle Patches 和 Patchsets 补丁号码快速参考 (文档 ID 1922396.1) Download Reference for Or ...
- 《Mysql DML语句》
1:DISTINCT 用于去重,但是需要注意的是,它是用于所有列的,也就是说,除非指定的列全部相同,否则所有的行都会被检索出来. 2:ORDER BY 用于排序,但是应该注意的是,它因该是 SELEC ...
- jquery图片懒加载效果
1.要引入jquery 2.要引入underscore.js <!DOCTYPE html> <html lang="en"> <head> & ...
- 添加linux系统调用的两种方式
原文:https://blog.csdn.net/sdulibh/article/details/51889279 向linux内核添加系统调用,一是通过编译内核添加,二是通过内核模块的方式添加: 一 ...