美文网首页
docker搭建运行hello-world

docker搭建运行hello-world

作者: ch_hanjian | 来源:发表于2020-02-19 16:58 被阅读0次

在linux环境安装docker-ce

1.首先我们需要卸载掉旧版本的docker,如果有的话,没有请跳过

sudo yum remove docker\docker-client\docker-client-latest\docker-common\docker-latest\docker-latest-logrotate\docker-logrotate\docker-engine

2.安装所需的软件包

sudo yum install-yyum-utils\device-mapper-persistent-data\lvm2

sudo yum-config-manager\--add-repo\https://download.docker.com/linux/centos/docker-ce.repo

3.安装最新版本docker-ce

sudo yum install docker-ce docker-ce-cli containerd.io

选择特定版本安装

sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io

VERSION_STRING根据yum list docker-ce--showduplicates| sort -r 查询

4.启动docker:sudo systemctl start docker

5.运行hello-world:sudo docker run hello-world 如下图显示表示已经成功

PS:docker pull hello-world的时候如果有如下报错,可能原因是

1.没有使用镜像加速,需要修改配置文件,V1.12之后版本,用户可以自行创建daemon.json文件对docker进行配置和调整

2.本地时间不正确,需要同步一下本地时间

yum -y install ntp ntpdate

ntpdate cn.pool.ntp.org

附录:

docker-io 支持 64 位版本的 CentOS6.5以上版本,且要求内核版本不低于 431

docker-ce 支持 64 位版本的 CentOS7 ,并且要求内核版本不低于 3.10

docker-io的安装

//docker-io的运行依赖

yum install -y epel-release

yum install -y docker-io

安装完成,配置文件信息cat /etc/sysconfig/docker

使用docker version 查看docker信息

启动服务 service docker start

docker info 查看运行情况

其他环境下搭建,详细文档参见官方文档

https://docs.docker.com/install/linux/docker

相关文章

网友评论

      本文标题:docker搭建运行hello-world

      本文链接:https://www.haomeiwen.com/subject/eimafhtx.html