linux设置docker自动启动,centos7安装docker并设置开机启动

版本要求:查看内核版本,需大于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) "

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 ~]# sudoservice 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

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

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

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

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

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

CentOS7 安装 Redis 并设置开机启动

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

CentOS7安装Tomcat9并设置开机启动

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

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

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

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 ...

centos安装redis并设置开机启动

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

CentOS7 安装 Docker 以及 Shipyard管理端

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

CentOS7 nginx 最简单的安装以及设置开机启动

1. 下载tar包. 2. 解压缩tar包 3. 安装必须的部分 yum包 yum install -y gcc pcre pcre-devel openssl openssl-devel gd gd ...

随机推荐

java常见面试题及答案 1-10(基础篇)

java常见面试题及答案 1.什么是Java虚拟机?为什么Java被称作是"平台无关的编程语言"? Java 虚拟机是一个可以执行 Java 字节码的虚拟机进程.Java 源文件被 ...

删除右键ATI CATALYST(R) Control Center的方法

http://share.weiyun.com/c47530d3e44ea15b606d4ba6f1b00a28

简单的div元素拖拽到div

drag1 drag2 drag3 代码如下:

div拖拽到div

load Event

document.addEventListener("DOMContentLoaded");------------------load document.body.addEven ...

使用sumlime text有感

学习JS和CSS.HTML用sublime text挺好的,这个工具不仅打开速度很快,而且也容易让页面运行(右键,在浏览器中打开),新建html页面的时候,先写个感叹号,然后按ctrl+e,会自动生成 ...

JAVA 求数组中的最大值

package Code411;//求数组的最大值public class CodeArrayMax { public static void main(String[] args) { int ar ...

Ubuntu系统下Anaconda使用方法总结

前言:个人认为Anaconda比pip使用起来要方便很多,因为它创建虚拟环境和下载各种库都很方便.但是有时候conda的安装方法中没有某些库,必须使用pip来进行安装.所以,主要用Anaconda,偶 ...

对字符串md5加密

public String getMD5(String str) { try { // 生成一个MD5加密计算摘要 MessageDigest md = MessageDigest.getInstan ...

JSTL自定义函数完成ACL即时认证

即时认证是指,用户进行查询或更新操作时,判断该用户进行是否对该操作有权限. 这里以判断用户是否有删除权限为例.如果用户有删除权限,即显示该按钮:如果没有删除权限,则不显示该按钮. 1.Manager层 ...

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值