• 版本要求:查看内核版本,需大于3.10
[root@localhost ~]# uname -r
3.10.-327.10..el7.x86_64
  • 更新内核:如果是生产机器务必慎重更新内核,避免出现不必要的问题。
sudo yum update
  • 安装docker
[root@localhost ~]# curl -sSL https://get.docker.com/ | sh 
+ sh -c 'sleep 3; yum -y -q install docker-engine'
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
warning: /var/cache/yum/x86_64//docker-main-repo/packages/docker-engine-selinux-1.10.-.el7.centos.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID 2c52609d: NOKEY
Public key for docker-engine-selinux-1.10.-.el7.centos.noarch.rpm is not installed
Importing GPG key 0x2C52609D:
Userid : "Docker Release Tool (releasedocker) <docker@docker.com>"
Fingerprint: 8e89 f3a9 7c07 0adb f762 2c52 609d
From : https://yum.dockerproject.org/gpg
setsebool: SELinux is disabled. If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like: sudo usermod -aG docker your-user Remember that you will have to log out and back in for this to take effect!
  • 启动docker
[root@localhost ~]# sudo service docker start
Redirecting to /bin/systemctl start docker.service
  • 测试
[root@localhost ~]# sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
03f4658f8b78: Pull complete
a3ed95caeb02: Pull complete
Digest: sha256:8be990ef2aeb16dbcb9271ddfe2610fa6658d13f6dfb8bc72074cc1ca36966a7
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:
. The Docker client contacted the Docker daemon.
. The Docker daemon pulled the "hello-world" image from the Docker Hub.
. 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 Hub account:
https://hub.docker.com For more examples and ideas, visit:
https://docs.docker.com/userguide/
  • 设置开机启动
[root@localhost ~]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
  • 将指定用户添加到用户组
usermod -aG docker your_username

  退出,然后重新登录,以便让权限生效。

centos7安装docker并设置开机启动的更多相关文章

  1. CentOS 7.6 64位安装docker并设置开机启动

    步骤如下 安装docker.docker-compose yum -y install docker-io docker-compose 启动docker service docker start 设 ...

  2. centos7安装docker并设置开机自启以及常用命令

    Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的 Linux 机器上,也可以实现虚拟化.容器是完全使用沙箱机制,相互之间不会有任何 ...

  3. CentOS7 安装 Redis 并设置开机启动

    1.下载 https://redis.io/download cd /usr/local/src wget -c http://download.redis.io/releases/redis-3.2 ...

  4. CentOS7安装Tomcat9并设置开机启动

    1.下载 Tomcat 9 CentOS 7 下创建目录并下载文件: cd /usr/local/ mkdir tomcat cd tomcat wget http://mirrors.hust.ed ...

  5. CentOS7安装完毕,重新开机启动后显示: Initial setup of CentOS Linux 7 (core)

    CentOS7安装完毕,重新开机启动后显示: Initial setup of CentOS Linux 7 (core) 1) [x] Creat user 2) [!] License infor ...

  6. 源码编译安装nginx及设置开机启动项

    1.上传nginx文档:解压到/data目录下,并安装依赖包tar xf nginx-1.20.1.tar.gz -C /data/cd /data/nginx-1.20.1/ && ...

  7. Linux上安装ZooKeeper并设置开机启动(CentOS7+ZooKeeper3.4.10)

    1下载Zookeeper 2安装启动测试 2.1上载压缩文件并解压 2.2新建 zookeeper配置文件 2.3安装JDK 2.4启动zookeeper 2.5查看zookeeper的状态 3将Zo ...

  8. centos安装redis并设置开机启动

    1.通过yum安装: yum install redis 2.设置redis.conf中daemonize为yes.设置密码: requirepass 3.安装完后的启动脚本是完善的,/etc/ini ...

  9. CentOS7 安装 Docker 以及 Shipyard管理端

    简介: Docker 是一个开源工具,它可以让创建和管理 Linux 容器变得简单.容器就像是轻量级的虚拟机,并且可以以毫秒级的速度来启动或停止. Docker 帮助系统管理员和程序员在容器中开发应用 ...

随机推荐

  1. yii2中事务不能回滚的解决

    $player1 = Player::findOne(1); $player1->nickname = '111'; $player2 = Player::findOne(2); $player ...

  2. linux下生成core dump文件方法及设置

    linux下生成core dump文件方法及设置    from:http://www.cppblog.com/kongque/archive/2011/03/07/141262.html core ...

  3. PHP常用的一些正则表达式

    附一些常用的正则运算: 验证数字:^[0-9]*$验证n位的数字:^\d{n}$验证至少n位数字:^\d{n,}$验证m-n位的数字:^\d{m,n}$验证零和非零开头的数字:^(0|[1-9][0- ...

  4. 淘宝首页源码藏美女彩蛋(上)(UED新作2013egg)

    今日,偶尔翻看淘宝源码,发现竟有美女形状源码.如下图: 此段代码在console中运行,结果更为惊叹. 亲手尝试的读者已经看到了代码运行的结果.taobao.com的console打印出了UED的招聘 ...

  5. 【CISP笔记】安全漏洞与恶意代码(2)

    恶意代码自我保护 进程保护 进程守护 超级权限 检测对抗 反动态调试 反静态调试 恶意代码检测技术 特征码扫描 沙箱技术 行为检测 恶意代码分析技术 静态分析 需要实际执行恶意代码,它通过对其二进制文 ...

  6. 【PHP面向对象(OOP)编程入门教程】6.如何去使用对象中的成员

    上面看到PHP对象中的成员有两种一种是成员属性, 一种是成员方法.对象我们以经可以声明了,$p1=new Person(); 怎么去使用对象的成员呢?要想访问对象中的成员就要使用一个特殊的操作符”-& ...

  7. Windbg学习使用

    WinDbg是微软发布的一款相当优秀的源码级(source-level)调试工具,可以用于Kernel模式调试和用户模式调试,还可以调试Dump文件. 1. WinDbg介绍:    Debuggin ...

  8. JS快速获取图片宽高的方法

    快速获取图片的宽高其实是为了预先做好排版样式布局做准备,通过快速获取图片宽高的方法比onload方法要节省很多时间,甚至一分钟以上都有可能,并且这种方法适用主流浏览器包括IE低版本浏览器. 我们一步一 ...

  9. C 文件读写 容易疏忽的一个问题

    今天需要解决一个问题,将影像瓦片(一堆jpg文件)分别进行读取,并将所有数据以文件流的方式存入一个.db的文件中, 同时将每个jpg数据在db文件中的位置保存下来,作为index存在.idx文件中. ...

  10. 支付宝Payto接口的C#.net实现方法

    例一: using System; using System.Data; using System.Configuration; using System.Collections; using Sys ...