广告
返回顶部
首页 > 资讯 > 精选 >docker学习1:CentOS Docker 安装
  • 471
分享到

docker学习1:CentOS Docker 安装

2023-06-06 03:06:26 471人浏览 泡泡鱼
摘要

参考:Http://www.runoob.com/Docker/Centos-docker-install.htmlCentOS Docker 安装Docker支持以下的CentOS版本:CentOS 7 (64-bit)CentOS 6.

参考:
Http://www.runoob.com/Docker/Centos-docker-install.html

CentOS Docker 安装
Docker支持以下的CentOS版本:
CentOS 7 (64-bit)
CentOS 6.5 (64-bit) 或更高的版本




前提条件
目前,CentOS 仅发行版本中的内核支持 Docker。
Docker 运行在 CentOS 7 上,要求系统为64位、系统内核版本为 3.10 以上。
Docker 运行在 CentOS-6.5 或更高的版本的 CentOS 上,要求系统为64位、系统内核版本为 2.6.32-431 或者更高版本。


使用 yum 安装(CentOS 7下)
Docker 要求 CentOS 系统的内核版本高于 3.10 ,查看本页面的前提条件来验证你的CentOS 版本是否支持 Docker 。
通过 uname -r 命令查看你当前的内核版本


[root@huixuan ~]# uname -a 
linux huixuan 3.10.0-514.el7.x86_64 #1 SMP Tue Nov 22 16:42:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
[root@huixuan ~]# 


安装 Docker
Docker 软件包和依赖包已经包含在默认的 CentOS-Extras 软件源里,安装命令如下:


启动 Docker 后台服务
service docker start


之后需要修改:Docker0网桥默认网段
[root@huixuan ~]# ps -ef | grep docker
root      3691     1  0 17:28 ?        00:00:00 /usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupdriver=systemd --userland-proxy-path=/usr/libexec/docker/docker-proxy-current --seccomp-profile=/etc/docker/seccomp.JSON --selinux-enabled --log-driver=journald --signature-verification=false --storage-driver overlay2
root      3698  3691  0 17:28 ?        00:00:00 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --shim docker-containerd-shim --runtime docker-runc --runtime-args --systemd-cgroup=true
root      3838  3817  0 17:30 pts/0    00:00:00 grep --color=auto docker
[root@huixuan ~]# 




测试运行 hello-world
[root@huixuan ~]# docker run hello-world
Unable to find image 'hello-world:latest' locally
Trying to pull repository docker.io/library/hello-world ... 
latest: Pulling from docker.io/library/hello-world
9bb5a5d4561a: Pull complete 
Digest: sha256:f5233545e43561214ca4891fd1157e1c3c563316ed8e237750d59bde73361e77
Status: Downloaded newer image for docker.io/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/engine/userguide/


[root@huixuan ~]# 




使用脚本安装 Docker
1、使用 sudo 或 root 权限登录 Centos。
2、确保 yum 包更新到最新。
yum update




3、执行 Docker 安装脚本。
[root@huixuan ~]# curl -fsSL https://get.docker.com/ | sh
# Executing docker install script, commit: 36b78b2
Warning: the "docker" command appears to already exist on this system.


If you already have Docker installed, this script can cause trouble, which is
why we're displaying this warning and provide the opportUnity to cancel the
installation.


执行这个脚本会添加 docker.repo 源并安装 Docker。




4、启动 Docker 进程。
[root@huixuan ~]# service docker start 
Redirecting to /bin/systemctl start docker.service




5、验证 docker 是否安装成功并在容器中执行一个测试的镜像。
[root@huixuan ~]# docker run hello-world


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/engine/userguide/


[root@huixuan ~]# 


到此,docker 在 CentOS 系统的安装完成。






镜像加速
鉴于国内网络问题,后续拉取 Docker 镜像十分缓慢,我们可以需要配置加速器来解决,我使用的是网易的镜像地址:http://hub-mirror.c.163.com。
新版的 Docker 使用 /etc/docker/daemon.json(Linux) 或者 %programdata%\docker\config\daemon.json(windows) 来配置 Daemon。
请在该配置文件中加入(没有该文件的话,请先建一个):


[root@huixuan ~]# cat /etc/docker/daemon.json 
{
  "reGIStry-mirrors": ["http://hub-mirror.c.163.com"]
  "bip":"192.168.100.1/24"
}
[root@huixuan ~]# 


--结束END--

本文标题: docker学习1:CentOS Docker 安装

本文链接: https://www.lsjlt.com/news/245882.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
  • docker学习1:CentOS Docker 安装
    参考:http://www.runoob.com/docker/centos-docker-install.htmlCentOS Docker 安装Docker支持以下的CentOS版本:CentOS 7 (64-bit)CentOS 6....
    99+
    2023-06-06
  • CentOS 7安装Docker
    若无linux系统,详见https://www.jb51.net/article/232585.htm 进行下载安装 工欲善其事,必先利其器,为方便传输文件与复制粘贴,需要先安装几个的工具: 1、linux中安装ssh ...
    99+
    2022-06-04
    CentOS安装Docker Linux安装Docker
  • centos怎样安装Docker
    这篇文章主要为大家展示了“centos怎样安装Docker”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“centos怎样安装Docker”这篇文章吧。安装Doc...
    99+
    2022-10-19
  • CentOS 8.4怎么安装Docker
    本篇内容介绍了“CentOS 8.4怎么安装Docker”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!系统要求:Docker 支持 64 位...
    99+
    2023-06-25
  • CentOS上怎么安装Docker
    这篇文章给大家分享的是有关CentOS上怎么安装Docker的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。 CentOS上安装Docker 简介 Docker 属于 Lin...
    99+
    2022-10-19
  • centos中如何安装docker
    centos中安装docker的方法:1、打开centos终端;2、在命令行中输入“curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun”命令自动安装docke...
    99+
    2022-10-04
  • CentOS安装Docker的方法
    要求 Docker可以运行在64位CentOS7.X和64位CentOS6.5(含,以上)系统内。 7.X内核版本要求3.10以上 6.5(含,以上)的内核版本要求2.6.32-43...
    99+
    2022-11-13
  • CentOS 8如何安装docker
    这篇文章主要为大家展示了“CentOS 8如何安装docker”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“CentOS 8如何安装docker”这篇文章吧。centos8安装docker官方文...
    99+
    2023-06-25
  • 【MongoDB学习笔记1】基于CentOS 6.5安装MongoDB
    1.添加MongoDB安装源vim /etc/yum.repos.d/mongodb-enterprise.repo将下列配置项写入文件[mongodb-enterprise] name=Mong...
    99+
    2022-10-18
  • CentOS中怎么快速安装docker
    这篇文章主要讲解了“CentOS中怎么快速安装docker”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“CentOS中怎么快速安装docker”吧!卸载旧版本sudo yum&nb...
    99+
    2023-06-27
  • 怎么在CentOS 8.1上安装 Docker
    怎么在CentOS 8.1上安装 Docker,相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。下载了CentOS 8.1,并尝试安装docker。我们将了解如何使用官方...
    99+
    2023-06-05
  • 怎么在CentOS 7上安装Docker
    本篇内容介绍了“怎么在CentOS 7上安装Docker”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!Docker 是一个开源工具,它可以让...
    99+
    2023-06-16
  • docker学习5:Docker 容器连接
    参考:http://www.runoob.com/docker/docker-container-connection.html前面我们实现了通过网络端口来访问运行在docker容器内的服务。下面我们来实现通过端口连接到一个docker容器...
    99+
    2023-06-06
  • centos下docker安装及springboot远程发布docker的方法
    目录1.CentOS7.0下JDK1.8的安装2.Docker的安装3.Docker使用Maven插件构建并上传镜像1.CentOS7.0下JDK1.8的安装 (1)到Oracle官...
    99+
    2022-11-12
  • CentOS 8安装docker最详细方法
    centos8安装docker 官方文档:https://docs.docker.com/engine/install/centos/ 1.系统环境 cat /etc/redhat...
    99+
    2022-11-12
  • CentOS 8.4安装Docker的详细教程
    目录前言:系统要求:安装环境:卸载旧版本:yum到底是干什么的?使用yum安装:配置yum稳定镜像源:安装 DockerCentOS8 额外设置开启Docker服务:启动 Docke...
    99+
    2022-11-12
  • CentOS 8安装Docker的详细教程
    1、御载以前的版本 yum remove docker docker-client docker-client-latest docker-common docker-lates...
    99+
    2022-11-12
  • 在CentOS 6.x上怎么安装docker
    本篇内容主要讲解“在CentOS 6.x上怎么安装docker”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“在CentOS 6.x上怎么安装docker”吧!1...
    99+
    2022-10-19
  • 为Centos安装指定版本的Docker
    安装 Docker 从 2017 年 3 月开始 docker 在原来的基础上分为两个分支版本: Docker CE 和 Docker EE。 Docker CE 即社区免费版,Do...
    99+
    2022-11-13
  • CentOS 8安装Docker方法是什么
    本篇内容主要讲解“CentOS 8安装Docker方法是什么”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“CentOS 8安装Docker方法是什么”吧!1、御载以前的版本y...
    99+
    2023-06-22
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作