docker安装-官网实例中文(centos7)

本文档介绍了在CentOS7上安装Docker的步骤,包括关闭防火墙、配置SELINUX和安装Docker。接着,通过运行'hello-world'和'whalesay'镜像来演示Docker的基本用法,并详细解释了Docker镜像和容器的概念。此外,还指导了如何构建自定义镜像和创建Docker Hub账户。
摘要由CSDN通过智能技术生成

1.    docker安装

1.1         关闭防火墙

# systemctl stopfirewalld

# systemctl disablefirewalld

1.2         SELINUX 配置

编辑文件/etc/selinux/config ,设置

SELINUX=DISABLED

然后运行命令

# setenforce 0

重启服务器

# reboot

 

1.3         开始安装

更新现有包

yum update

执行docker安装脚本

curl -sSLhttps://get.docker.com/ | sh

启动docker服务

systemctl start docker

确认docker安装成功

docker run hello-world

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

latest: Pulling fromhello-world

a8219747be10: Pullcomplete 91c95931e552: Already exists

hello-world:latest: Theimage you are pulling has been verified. Important: image verification is atech preview feature and should not be relied on to provide security. Digest:sha256:aa03e5d0d5553b4c3473e89c8619cf79df368babd1.7.1cf5daeb82aab55838d

Status: Downloaded newerimage for hello-world:latest

Hello from Docker.

This message shows thatyour installation appears to be working correctly.

To generate thismessage, Docker took the following steps:

1. The Docker clientcontacted the Docker daemon.

2. The Docker daemonpulled the "hello-world" image from the Docker Hub.

(Assuming it was notalready locally available.)

3. The Docker daemoncreated a new container from that image which runs the executable that producesthe output you are currently reading. 4. The Docker daemon streamed that outputto the Docker client, which sent it to your terminal.

To try something moreambitious, you can run an Ubuntu container with:

 $ docker run -it ubuntu bash

For more examples andideas, visit: http://docs.docker.com/userguide/

 

 

2.    了解docker的镜像和容器

在上一步中,运行了

docker run hello-world

执行这一个命令,你完成了使用docker的核心任务。

你运行的命令分为三个部分。

一个容器是

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值