linux上安装Docker


前言

很多同学一看到docker,就说,这个我知道,不就是DOTA 2 游戏吗?这个我天天玩,

大哥,麻烦你看清楚好不好,别宝里宝气的,好不咯,哈哈哈哈

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


提示:以下是本篇文章正文内容,下面案例可供参考

一、虚拟化技术

二.云计算

1.云的分类:

2.IasS和PaaS

三.实验操作:

环境准备:
准备一台全新的centos8的系统
或者Ubuntu 20 server的系统

1.到底使用那个系统?

centos --》有结束日期
centos linux8 --》2021-12-31
centos linux7 --》2024-6-30centos 是开源的,并且免费RHEL9 --》red hat  enterprice  linux  9red hat 开源,但是收费的  --》商业版本centos 被red hat收购 ---》centos 成了redhat的试验场Ubuntu cali@sanchuang:~/fabric/scripts$ cat /etc/issueUbuntu 20.04.2 LTS \n \lcali@sanchuang:~/fabric/scripts$debian

centos8.4.2105 -->2c/4G/100G
root账号已经比禁用了–》设置密码就启用了

ubuntu20.04.2 -->2c/4G/100G

2.docker 是什么?

(1)docker --》是一个软件,使用GO语言开发的一个软件, 对容器进行管理容器管理软件

集装箱 装货物 : --》容器 container --》把一个进程装到容器里 --》控制这个进程的资源消耗(cpu,内存)

(2)hypervisor :超级监督者;管理程序

VMware 是美国一个虚拟化厂商 --》VMware(威睿) 是全球桌面到数据中心虚拟化解决方案的领导厂商。

VMware ESXi:专门构建的裸机 Hypervisor

(3)裸机: 没有安装系统的机器
裸机 --》VMware ESXi
VMWARE workstation --》 入门级的虚拟化软件 --》低端的

微服务 --》docker

说到底,其实docker的一个容器,背后就是一个进程

(4)Engine 引擎: 核心的部件

具体操作:

在centos8安装

[root@localhost ~]# hostnamectl set-hostname sc-docker
[root@localhost ~]# su - root
上一次登录:二 8月 10 15:27:37 CST 2021从 192.168.0.189pts/0 上
[root@sc-docker ~]#[root@sc-docker ~]# cat /etc/centos-release
CentOS Linux release 8.4.2105
[root@sc-docker ~]#**## ****

1.卸载旧版本的docker

\ 续行符号: 继续到下一行

yum remove docker \docker-client \docker-client-latest \docker-common \docker-latest \docker-latest-logrotate \docker-logrotate \docker-engine#The Docker Engine package is now called docker-ce.[root@sc-docker ~]# yum install -y yum-utils

2.添加yum仓库文件

添加docker官方的yum仓库文件,一会儿我们需要去docker官方的yum仓库下载软件

[root@sc-docker ~]# yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
添加仓库自:https://download.docker.com/linux/centos/docker-ce.repo
[root@sc-docker ~]#添加阿里云的镜像docker仓库 ---》推荐使用
[root@sc-docker ~]# yum-config-manager \
--add-repo \
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
添加仓库自:http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
[root@sc-docker ~]#
[root@sc-docker yum.repos.d]# cd /etc/yum.repos.d/  存放所有的yum仓库文件的
[root@sc-docker yum.repos.d]# ls
CentOS-Linux-AppStream.repo          CentOS-Linux-Devel.repo             CentOS-Linux-Media.repo       docker-ce.repo
CentOS-Linux-BaseOS.repo             CentOS-Linux-Extras.repo            CentOS-Linux-Plus.repo
CentOS-Linux-ContinuousRelease.repo  CentOS-Linux-FastTrack.repo         CentOS-Linux-PowerTools.repo
CentOS-Linux-Debuginfo.repo          CentOS-Linux-HighAvailability.repo  CentOS-Linux-Sources.repo
[root@sc-docker yum.repos.d]#docker-ce.repo 就是我们刚刚下载的

3.安装docker

 [root@sc-docker yum.repos.d]# yum install docker-ce docker-ce-cli containerd.io -y

4.启动docker,并且设置docker开机启动

[root@sc-docker yum.repos.d]# systemctl start docker
[root@sc-docker yum.repos.d]# systemctl enable docker
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.
[root@sc-docker yum.repos.d]#
[root@sc-docker yum.repos.d]# ps aux|grep docker
root       16210  0.4  2.0 1368904 79400 ?       Ssl  17:29   0:00 /usr/bin/dockerd-H fd:// --containerd=/run/containerd/containerd.sock
root       16363  0.0  0.0  12348  1112 pts/0    S+   17:30   0:00 grep --color=auto docker
[root@sc-docker yum.repos.d]#

5.测试运行一个docker容器

[root@sc-docker yum.repos.d]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b8dfde127a29: Pull complete
Digest: sha256:df5f5184104426b65967e016ff2ac0bfcd44ad7899ca3bbcf8e44e4461491a9e
Status: Downloaded newer image for hello-world:latestHello 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 theexecutable that produces the output you are currently reading.4. The Docker daemon streamed that output to the Docker client, which sent itto your terminal.To try something more ambitious, you can run an Ubuntu container with:$ docker run -it ubuntu bashShare 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@sc-docker yum.repos.d]#

Ubuntu里安装docker

https://docs.docker.com/engine/install/ubuntu/cali@sanchuang-server:~$ cat /etc/issue
Ubuntu 20.04.2 LTS \n \lcali@sanchuang-server:~$
卸载旧的docker
cali@sanchuang-server:~$ sudo apt-get remove docker docker-engine docker.io containerd runc
[sudo] password for cali:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package docker-engine
cali@sanchuang-server:~$cali@sanchuang-server:~$ sudo apt-get update  更新系统里的所有的能更新的软件

6.安装几个工具软件

cali@sanchuang-server:~$sudo apt-get install \apt-transport-https \ca-certificates \curl \gnupg \lsb-release

curl 是字符界面的浏览器

gpgkey 是用来验证软件的真伪 --》防伪的
cali@sanchuang-server:~$  curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
cali@sanchuang-server:~$cali@sanchuang-server:~$  echo \

"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu
( l s b r e l e a s e − c s ) s t a b l e " ∣ s u d o t e e / e t c / a p t / s o u r c e s . l i s t . d / d o c k e r . l i s t > / d e v / n u l l c a l i @ s a n c h u a n g − s e r v e r : (lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null cali@sanchuang-server:~ (lsbr​elease−cs)stable"∣sudotee/etc/apt/sources.list.d/docker.list>/dev/nullcali@sanchuang−server:

cali@sanchuang-server:~$ sudo apt-get update 再次更新系统
Hit:1 http://cn.archive.ubuntu.com/ubuntu focal InRelease
Get:2 https://download.docker.com/linux/ubuntu focal InRelease [52.1 kB]
Hit:3 http://cn.archive.ubuntu.com/ubuntu focal-updates InRelease
Get:4 http://cn.archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
Get:5 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages [10.7 kB]
Get:6 http://cn.archive.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Fetched 277 kB in 3s (95.9 kB/s)
Reading package lists... Done

7.安装docker-ce软件

cali@sanchuang-server:~$sudo apt-get install docker-ce docker-ce-cli containerd.io -y**(1)自动启动docker**cali@sanchuang-server:~$ ps aux|grep docker
root        3659  0.8  1.9 1309896 78164 ?       Ssl  09:39   0:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
cali        4816  0.0  0.0   6432   736 pts/0    S+   09:40   0:00 grep --color=auto docker
cali@sanchuang-server:~$**(2)测试**
cali@sanchuang-server:~$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b8dfde127a29: Pull complete
Digest: sha256:df5f5184104426b65967e016ff2ac0bfcd44ad7899ca3bbcf8e44e4461491a9e
Status: Downloaded newer image for hello-world:latestHello 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 theexecutable that produces the output you are currently reading.4. The Docker daemon streamed that output to the Docker client, which sent itto your terminal.To try something more ambitious, you can run an Ubuntu container with:$ docker run -it ubuntu bashShare 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/**cali@sanchuang-server:~$

总结:

1.本篇文章只是简单地介绍了什么是docker,教你如何在Centos安装docker,简单易上手.

2.我个人对于docker的理解就是,它就像一个海量的APP store,只是它不像手机上,我安装了微信就可以马上去视频,docker需要去pull images,是很方便的,像常用的python和MySQL上面都有,只有你想不到的,没有它没有的.

3.最后一句,也是最重要的,一定要动手操作,有任何问题可以评论或者留言哈.

【VMware】【CentOS 7 】Docker第一课:安装Docker相关推荐

  1. centos 7.9 yum 安装最新版docker与dnf安装docker compose v2

    centos 7.9 yum 安装最新版docker与dnf安装docker compose v2 一.环境查看 1.系统内核 #uname -r 2.系统版本 #cat /etc/redhat-re ...

  2. 【阿里云镜像】使用阿里云Docker CE 镜像安装Docker

    文章目录 一.参考链接 二.Docker CE简介 三.使用阿里云Docker CE镜像安装Docker 1.SSH连接CentOS 7系统 2.基于CentOS 7安装配置Docker(使用 yum ...

  3. centos7 docker安装_教你如何在 CentOS 7 下 yum 方式安装 Docker 环境

    记录在CentOS 7下使用yum方式安装Docker环境的步骤. 1.移除旧版本: yum remove docker \                  docker-client \      ...

  4. Ubuntu/CentOS下使用脚本自动安装 Docker

    Ubuntu.Debian 系列安装 Docker 系统要求 Docker 支持以下版本的 Ubuntu 和 Debian 操作系统: Ubuntu Xenial 16.04 (LTS) Ubuntu ...

  5. win7 docker linux,win7安装docker并部署CentOS+宝塔环境

    安装docker Toolbox 安装好后桌面会多出三个图标,分别是:Oracle VM VirtualBox,Kitematic (Alpha),Docker Quickstart Terminal ...

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

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

  7. Docker入门之安装Docker

    目录 目录 1 1. 前言 2 2. 基本概念 3 2.1. 仓库 3 2.2. 镜像ID和容器ID 3 3. 创建网桥 3 4. 安装Docker 4 4.1. 二进制安装 4 4.1.1. 下载安 ...

  8. docker学习-1CentOS安装Docker CE

    1 moby.docker-ce与docker-ee docker原是一个开源项目,主要由docker公司维护,2017年年初,docker公司将原先的docker项目改名为moby,并创建了dock ...

  9. centos7下安装docker(14安装docker machine​)

    为所有host安装和配置docker 之前我们手工安装了一个docker host: 1.安装https CA证书 2.添加GPG key 3.添加docker apt源 4.安装docker     ...

最新文章

  1. docker+springboot部署总结
  2. 编程之美 3.10 分层遍历二叉树
  3. Vue 中的 v-if 和 v-show 修饰符
  4. maven web项目保存log4j日志到WEB-INF
  5. linux shell之awk
  6. 'parent.relativePath' points at no local POM
  7. c语言发展过程,C语言发展史
  8. 个人漂浮装置UL安全标准 - 第 5 部分:浮力辅助设备(50 级) - 安全要求 UL 12402-5介绍
  9. 网易云音乐登陆显示服务器错误,网易云音乐-登录业务流程还原
  10. STM32毕业设计项目
  11. Qt 的 linuxFB XCB KMS XCB Wayland
  12. php论坛整合,phpcms+ucenter+discuz论坛整合教程
  13. 浅谈简单快捷的服务器——私有云服务器!
  14. 左右滑屏设置_王者荣耀怎么滑屏操作 滑屏手法详解[多图]
  15. python -简易密码生成器
  16. 09组团队项目-Beta冲刺-3/5
  17. 使用GBase企业管理器执行 select count(1) into @c from t1;报错解决方案
  18. 数字IC所用软件及IP分类
  19. 智慧建筑的几个常见误区
  20. 针对 store_name 字段

热门文章

  1. 手机屏幕物理点击器是什么原理_触屏手机为什么能触屏原理是什么
  2. 网络安全入门(一)IP欺骗
  3. 蜣螂优化(DBO)算法(含MATLAB代码)
  4. CSS同时使用背景图片和背景颜色
  5. python程序员现状_天才Python程序员身价上亿却被说挫,6个月减90斤,逆袭成文艺范男神!...
  6. 如何用Python提高工作的核心竞争力?
  7. linux网络配置出现E325,打开Vi编辑器出现E325: ATTENTION的解决方法
  8. 定向爬取新浪股票和百度股票数据
  9. 【转】睡五分钟等于六钟头的方法
  10. 解决无线网络未连接,连接不可用