Docker ???What???
Docker是一种开源的容器化平台,可以让开发者轻松地构建、打包、运输和部署应用程序。Docker容器是轻量级的、可移植的、自包含的软件包,其中包含了应用程序和其所有的依赖项,从而保证了应用程序的一致性和可移植性。Docker通过使用容器技术,可以实现快速部署、扩展和管理应用程序,同时提高了开发和运维的效率。 -ChipGPT
docker是一个用来装应用的容器,就像杯子可以装水,笔筒可以放笔,书包可以放书,可以把hello word放在docker中,可以把网站放入docker中,可以把任何想得到的程序放在docker中.
安装docker预备工作
Docker 要求 CentOS 系统的内核版本高于 3.10,查看本页面的前提条件来验证你的CentOS 版本是否支持 Docker 。
若安装过请看最下文~~~
检查centos7系统内核版本
通过uname -r
命令查看你当前的内核版本.
安装所需要的依赖包 yum-utils
[root@centos7-9-2009-zsc ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
设置仓库
docker默认的官方仓库:
# 官方仓库,国内访问较慢,建议使用阿里源
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
安装docker
docker社区、ee企业版 ce为社区版 官方推荐使用ce版,默认安装最新的docker版本,亦可指定版本。
yum install docker-ce docker-ce-cli containerd.io
经过漫长的等待终于完成啦~
启动
systemctl start docker
检查docker是否启动
使用docker version
测试docker·
使用hello-world镜像测试docker
docker run hello-world
docker run hello-world
[root@centos7-9-2009-zsc ~]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
719385e32844: Pull complete
Digest: sha256:fc6cf906cbfa013e80938cdf0bb199fbdbb86d6e3e013783e5a766f50f5dbce0
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 images
重新安装?
如果安装过请先卸载
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
学会啦安装?怎么卸载?
卸载依赖
yum remove docker-ce docker-ce-cli containerd.io
删除资源
rm -rf /var/lib/docker
最后?怎么使用阿里镜像服务? 详情请看下方链接或我的文章:【Docker_image_source】docker设置国内镜像源
【Docker_image_source】docker设置国内镜像源
http://t.csdn.cn/OJzja