赞
踩
Docker 官网:https://www.docker.com/
Docker 文档地址:https://docs.docker.com/
Docker 仓库地址:https://hub.docker.com/
Docker 是一个开源的应用`容器引擎`,让开发者可以打包自己的应用和依赖到一个可移植的`镜像`中,然后发布到任何 Linux 或者 Windows 机器上
Docker 也可以实现虚拟化。容器完全使用沙箱机制,相互之间不会有任何的接口
Docker 镜像(Image)就是一个只读的模板,镜像可以用来创建 Docker 容器,一个镜像可以创建很多容器。比如类是镜像,对象就是容器
ocker 利用容器(container)独立运行的一个或者一组命令,容器是使用镜像创建的运行实例
容器可以被启动、开始、停止、删除,每个容器都是相互隔离的,保证安全的平台
容器的定义和镜像几乎一模一样,也是一堆层的统一视角,区别在于容器最上面那一层是可读可写的
仓库(repository)是集中存放镜像文件的场所,用來保存各种打包好的软件镜像
仓库(Repository)和仓库注册服务器(Registry)是有区别的,仓库注册服务器上往往存放着多个仓库,每个仓库包含了多个镜像,每个镜像有不同的标签(tag)
仓库分为 public 公开仓库和 private 私有仓库两种形式
官网安装参考手册:https://docs.docker.com/engine/install/centos/
uname-r
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
sudo yum install -y yum-utils device-mapper-persistent-data \
lvm2
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
阿里云国内镜像
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum -y install docker-ce docker-ce-cli containerd.io
docker version
# 启动docker
systemctl start docker
# 加入开机启动
systemctl enable docker
docker run hello-world
安装成功显示下面代码!
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete
Digest: sha256:95ddb6c31407e84e91a986b004aee40975cb0bda14b5949f6faac5d2deadb4b9
Status: Downloaded newer image for 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/get-started/
Docker 官方镜像仓库 https://hub.docker.com/
# 在 docker/daemon.json 文件中
{
"registry-mirrors":["https://registry.docker-cn.com"], # 镜像地址
"insecure-registries":["ip:port"] # IP 和 端口
}
sudo systemctl daemon-reload
sudo systemctl restart docker
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。