CentOS 7.6 安装docker

1.查看内核

[root@CentOS7 ~]# uname -r

3.10.0-957.21.3.el7.x86_64

[root@CentOS7 ~]#

2. 安装docker

[root@CentOS7 ~]# curl -sSL https://get.docker.com/ | sh

# Executing docker install script, commit: 6bf300318ebaab958c4adc341a8c7bb9f3a54a1a

+ sh -c 'yum install -y -q yum-utils'

软件包 yum-utils-1.1.31-50.el7.noarch 已安装并且是最新版本

+ sh -c 'yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo'

已加载插件:fastestmirror, langpacks

adding repo from: https://download.docker.com/linux/centos/docker-ce.repo

grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo

repo saved to /etc/yum.repos.d/docker-ce.repo

+ '[' stable '!=' stable ']'

+ sh -c 'yum makecache'

已加载插件:fastestmirror, langpacks

Loading mirror speeds from cached hostfile

* base: mirror.jdcloud.com

* extras: mirror.bit.edu.cn

* updates: mirror.bit.edu.cn

ambari-2.7.3.0                                                  | 2.9 kB  00:00:00   

base                                                                  | 3.6 kB  00:00:00   

docker-ce-stable                                                | 3.5 kB  00:00:00   

extras                                                                 | 3.4 kB  00:00:00   

updates                                                              | 3.4 kB  00:00:00   

(1/13): base/7/x86_64/other_db                         | 2.6 MB  00:00:00   

(2/13): docker-ce-stable/x86_64/filelists_db       |  15 kB  00:00:00   

(3/13): ambari-2.7.3.0/other_db                          | 1.4 kB  00:00:00   

(4/13): docker-ce-stable/x86_64/primary_db      |  30 kB  00:00:00   

(5/13): extras/7/x86_64/filelists_db                     | 246 kB  00:00:00   

(6/13): docker-ce-stable/x86_64/other_db          | 112 kB  00:00:00   

(7/13): extras/7/x86_64/prestodelta                    |  65 kB  00:00:00   

(8/13): docker-ce-stable/x86_64/updateinfo       |  55 B  00:00:00   

(9/13): extras/7/x86_64/other_db                        | 127 kB  00:00:00   

(10/13): updates/7/x86_64/other_db                   | 659 kB  00:00:00   

(11/13): ambari-2.7.3.0/filelists_db                      | 103 kB  00:00:01   

(12/13): updates/7/x86_64/filelists_db                 | 4.6 MB  00:00:00   

(13/13): base/7/x86_64/filelists_db                      | 7.1 MB  00:00:02   

元数据缓存已建立

+ '[' -n '' ']'

+ sh -c 'yum install -y -q docker-ce'

warning: /var/cache/yum/x86_64/7/docker-ce-stable/packages/docker-ce-18.09.8-3.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY

docker-ce-18.09.8-3.el7.x86_64.rpm 的公钥尚未安装

导入 GPG key 0x621E9F35:

用户ID    : "Docker Release (CE rpm) <docker@docker.com>"

指纹      : 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35

来自      : https://download.docker.com/linux/centos/gpg

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!

WARNING: Adding a user to the "docker" group will grant the ability to run

        containers which can be used to obtain root privileges on the

        docker host.

        Refer to https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface

        for more information.

3.启动docker

[root@CentOS7 ~]# service docker start

Redirecting to /bin/systemctl start docker.service

4.测试docker

[root@CentOS7 ~]# docker run hello-world

Unable to find image 'hello-world:latest' locally

latest: Pulling from library/hello-world

1b930d010525: Pull complete

Digest: sha256:6540fc08ee6e6b7b63468dc3317e3303aae178cb8a45ed3123180328bcc1d20f

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/

[root@CentOS7 ~]# docker info

Containers: 1

Running: 0

Paused: 0

Stopped: 1

Images: 1

Server Version: 18.09.8

Storage Driver: overlay2

Backing Filesystem: xfs

Supports d_type: true

Native Overlay Diff: true

Logging Driver: json-file

Cgroup Driver: cgroupfs

Plugins:

Volume: local

Network: bridge host macvlan null overlay

Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog

Swarm: inactive

Runtimes: runc

Default Runtime: runc

Init Binary: docker-init

containerd version: 894b81a4b802e4eb2a91d1ce216b8817763c29fb

runc version: 425e105d5a03fabd737a126ad93d62a9eeede87f

init version: fec3683

Security Options:

seccomp

  Profile: default

Kernel Version: 3.10.0-957.21.3.el7.x86_64

Operating System: CentOS Linux 7 (Core)

OSType: linux

Architecture: x86_64

CPUs: 2

Total Memory: 2.386GiB

Name: CentOS7

ID: V6H5:7DSN:DFAP:YGCG:K2KC:K5RI:TFD4:TSKZ:LT3C:WWLQ:73WA:2Y4F

Docker Root Dir: /var/lib/docker

Debug Mode (client): false

Debug Mode (server): false

Registry: https://index.docker.io/v1/

Labels:

Experimental: false

Insecure Registries:

127.0.0.0/8

Live Restore Enabled: false

Product License: Community Engine

[root@CentOS7 ~]#

5.设置开机启动

[root@CentOS7 ~]# systemctl enable docker

Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

[root@CentOS7 ~]#

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 194,457评论 5 459
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 81,837评论 2 371
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 141,696评论 0 319
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 52,183评论 1 263
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 61,057评论 4 355
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 46,105评论 1 272
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 36,520评论 3 381
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 35,211评论 0 253
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 39,482评论 1 290
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 34,574评论 2 309
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 36,353评论 1 326
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 32,213评论 3 312
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 37,576评论 3 298
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 28,897评论 0 17
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,174评论 1 250
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 41,489评论 2 341
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 40,683评论 2 335

推荐阅读更多精彩内容