Docker----安装 Docker 环境

网友投稿 248 2022-10-17

Docker----安装 Docker 环境

@TOC

一、CentOS 系统安装 Docker

1.1 卸载已存在的docker

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

1.2 安装Docker

(1) 执行如下命令安装基础依赖

yum -y install gcc yum -y install gcc-c++ yum install -y yum-utils

(2) 配置阿里云镜像源

yum-config-manager \ --add-repo \ 安装 docker

yum install -y docker-ce docker-ce-cli containerd.io

(4) 启动 docker

systemctl start docker

(5) 查看 docker 版本

docker version

1.3 验证 docker 是否已经安装成功

(1) 使用 hello-world 镜像启动容器

docker run hello-world

(2) 启动容器后,有类似如下显示,表示 docker 已经安装成功

[root@iZbp1flzt6x7pxmxfhmxeeZ ~]# docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 2db29710123e: Pull complete Digest: sha256:2498fce14358aa50ead0cc6c19990fc6ff866ce72aeb5546e1d59caac3d0d60f 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/ [root@iZbp1flzt6x7pxmxfhmxeeZ ~]#

二、Windows10 系统安装 Docker

2.1 下载安装文件

2.2 开启 Windows 虚拟化

2.3 安装 Linux 子系统

2.3.1 命令行安装

(1) 以管理员权限打开 windows PowerShell, 然后执行 如下命令即可安装

wsl --install -d Ubuntu

命令行安装可能下载比较慢,可以考虑使用如下手工安装的方式

2.3.2 手工下载安装

2.3.3 设置开机启动 Hypervisor

在 powershell 中执行如下信息

bcdedit /set hypervisorlaunchtype auto

2.3.4 确认虚拟化已经开启

2.3.5 安装WSL2

然后双击安装即可

2.4 安装 docker

至此 在 Windows10 系统上 docker 已经安装成功

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Harbor----通过 Harbor 源码进行编译 Harbor
下一篇:基于java语言实现快递系统
相关文章

 发表评论

暂时没有评论,来抢沙发吧~