((這里引用知乎上大佬的說法: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