Docker 新手安装教程,教你从零开始安装Docker

原创 maolego 2021年08月15日 150 0

Docker 是一个开源的应用容器引擎,基于 Go 语言 并遵从 Apache2.0 协议开源。

Docker 可以让开发者打包他们的应用以及依赖包到一个轻量级、可移植的容器中,然后发布到任何流行的 Linux 机器上,也可以实现虚拟化。

容器是完全使用沙箱机制,相互之间不会有任何接口(类似 iPhone 的 app),更重要的是容器性能开销极低。

GCC环境依赖 非必要安装,为了防万一出现特色情况,建议安装一下

# gcc 环境依赖非必要安装
yum -y install gcc
yum -y install gcc-c++

docker 安装步骤1. 卸载旧的docker版本

yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine

docker 安装步骤2. 安装yum-utils软件包和设置镜像仓库

# 安装yum-utils软件包
  yum install -y yum-utils

 # 设置镜像仓库  这里使用阿里云是的
 yum-config-manager \
    --add-repo \
    https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

docker 安装步骤3. 安装docker引擎

#安装之前可以更新yum软件包索引 索引 ,这一步不是必须的
yum makecache fast

# docker-ce是社区版,一般都使用社区版
yum install -y docker-ce docker-ce-cli containerd.io

docker 安装步骤4. 启动docker

# 启动docker
systemctl start docker

docker 安装步骤5. 运行hello-world

#hello-world 来验证docker 是否成功安装
docker run hello-world

hello-world 镜像 运行成功

[root@~]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b8dfde127a29: Pull complete
Digest: sha256:0fe98d7debd9049c50b597ef1f85b7c1e8cc81f59c8d623fcb2250e8bec85b38
Status: Downloaded newer image for hello-world:latest</pre>
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://maolego.com/38.html
温馨提示: 本站所收集的部分公开资料来源于互联网,转载的目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议
相关文章 关键词:

发表回复

*