一、Docker本地安装
((这里引用知乎上大佬的说法:https://www.zhihu.com/question/48174633
服务器虚拟化解决的核心问题是资源调配,而容器解决的核心问题是应用开发、测试和部署。
一、参考帖子
Ubuntu 的 |Docker 文档
【docker】ubuntu完全卸载docker及再次安装_ubuntu 卸载docker client卸载-CSDN博客
Docker运行hello-world镜像失败或超时:Unable to find image ‘hello-world:latest‘ locally Trying to pull reposi_unable to find image 'hello-world:latest' locally-CSDN博客
二、实际操作
(1)转到 https://download.docker.com/linux/ubuntu/dists/。
(2)在列表中选择您的 Ubuntu 版本。
(3)转到 并选择适用的体系结构 (、 、 或 )。pool/stable/amd64armhfarm64s390x
(4)下载以下文件,用于 Docker 引擎、CLI、containerd、 和 Docker Compose 包:deb
- containerd.io_<version>_<arch>.deb
- docker-ce_<version>_<arch>.deb
- docker-ce-cli_<version>_<arch>.deb
- docker-buildx-plugin_<version>_<arch>.deb
- docker-compose-plugin_<version>_<arch>.deb
(5)安装包。将以下示例中的路径更新为 下载 Docker 包的位置。.deb
sudo dpkg -i ./containerd.io_<version>_<arch>.deb \./docker-ce_<version>_<arch>.deb \./docker-ce-cli_<version>_<arch>.deb \./docker-buildx-plugin_<version>_<arch>.deb \./docker-compose-plugin_<version>_<arch>.deb
(6)通过运行映像来验证安装是否成功:hello-world
sudo service docker startsudo docker run hello-world
三、运行失败时更换源
1、配置加速地址
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{"registry-mirrors": ["https://do.nark.eu.org","https://dc.j8.work","https://docker.m.daocloud.io","https://dockerproxy.com","https://docker.mirrors.ustc.edu.cn","https://docker.nju.edu.cn"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
systemctl status docker
2、检查是否配置成功
root@zh-vm:/home/WorkSpace/DOCKER# docker info
Client: Docker Engine - CommunityVersion: 28.3.3Context: defaultDebug Mode: falsePlugins:buildx: Docker Buildx (Docker Inc.)Version: v0.26.1Path: /usr/libexec/docker/cli-plugins/docker-buildxcompose: Docker Compose (Docker Inc.)Version: v2.6.0Path: /usr/libexec/docker/cli-plugins/docker-compose。。。 。。。Registry Mirrors:https://do.nark.eu.org/https://dc.j8.work/https://docker.m.daocloud.io/https://dockerproxy.com/https://docker.mirrors.ustc.edu.cn/https://docker.nju.edu.cn/Live Restore Enabled: false
3、运行docker run hello-world
root@zh-vm:/home/WorkSpace/DOCKER# docker run hello-worldHello 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 theexecutable that produces the output you are currently reading.4. The Docker daemon streamed that output to the Docker client, which sent itto your terminal.To try something more ambitious, you can run an Ubuntu container with:$ docker run -it ubuntu bashShare 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/
验证是否成功拉取hello-world镜像:
root@zh-vm:/home/WorkSpace/DOCKER# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest 1b44b5a3e06a 6 days ago 10.1kB