Docker学习记录(到docker-compose)

Docker

  • 官网:https://www.docker.com/
  • 文档:https://docs.docker.com/
  • 仓库:https://hub.docker.com/

Docker的组成
在这里插入图片描述

  1. 镜像 (images)
  2. 容器(container)
  3. 仓库(registry)

1. 安装Docker

#1.卸载原有的Docker
sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine
#2.安装yum-utils软件包
sudo yum install -y yum-utils
#3.设置稳定的存储库
sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
#4.安装Docker
sudo yum install docker-ce docker-ce-cli containerd.io
#5.启动Docker
sudo systemctl start docker
#6.查看版本
docker version
-------------------------------------------
Client: Docker Engine - Community
 Version:           19.03.8
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        afacb8b
 Built:             Wed Mar 11 01:27:04 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.8
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.17
  Git commit:       afacb8b
  Built:            Wed Mar 11 01:25:42 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

#7.测试Docker
sudo 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/get-started/

2. 底层原理

  • Docker Client:也称为Docker客户端。其实就是Docker提供命令行界面工具,是许多Docker用户与Docker进行交互的主要方式。

  • Docker daemon:是服务器组建,以Linux后台服务的方式运行,是Docker最核心的后台进程,我们也把它称为守护进程。它负责响应来自Docker Client的请求,然后将这些请求翻译成系统调用完成容器管理操作。

  • Docker Image:可以看作一个特殊的文件系统,除了提供运容器运行时所需要的程序、库、资源、配置等文件外,还包含了一些为运行时准备的参数(匿名卷,环境变量、用户等)。镜像不包含任何动态数据,其内容在构建之后也不会被改变。我们可将Docker镜像看成只读模版,通过它可以创建Docker容器。

  • Docker registry:是存储docker image的仓库

  • Docker Container:就是Docker镜像的运行实例,是真正运行项目程序、消耗系统资源、提供服务的地方。

3. 容器与虚拟机

在这里插入图片描述

Docker 的命令

1. 帮助命令

docker version	#版本信息<
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值