Docker 安装及镜像加速器配置
生活随笔
收集整理的這篇文章主要介紹了
Docker 安装及镜像加速器配置
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
前言
本次實驗使用的操作系統鏡像為 ubuntu-18.04.2-desktop
第一步 安裝操作系統
1.1 軟件下載
使用官方提供的 Ubuntu 18.04.2 Desktop 鏡像,下載地址:https://ubuntu.com/download
1.2 軟件安裝
此步驟省略
1.3 登錄后輸入以下命令,切入到 root 用戶
rsecc@rsecc:~$ sudo -i [sudo] password for rsecc:第二步 Docker 安裝
2.1 安裝必要的系統工具
root@rsecc:~# apt-get update root@rsecc:~# apt-get -y install apt-transport-https ca-certificates curl software-properties-common2.2 安裝 GPG 證書
root@rsecc:~# curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | apt-key add -2.3 寫入軟件源信息
root@rsecc:~# add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"2.4 更新并安裝 Docker-CE
root@rsecc:~# apt-get -y update root@rsecc:~# apt-get -y install docker-ce2.5 啟動 docker 并設置開機自啟
root@rsecc:~# systemctl start docker root@rsecc:~# systemctl enable docker2.6 測試
root@rsecc:~# docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 0e03bdcc26d7: Pull complete Digest: sha256:7f0a9f93b4aa3022c3a4c147a449bf11e0941a1fd0bf4a8e6c9408b2600777c5 Status: Downloaded newer image for hello-world:latestHello 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/第三章 配置 Docker 鏡像加速器
3.1 修改或創建 daemon 配置文件 /etc/docker/daemon.json 來使用加速器
root@rsecc:~# mkdir -p /etc/docker root@rsecc:~# tee /etc/docker/daemon.json <<-'EOF' {"registry-mirrors": ["https://registry.docker-cn.com"] } EOF3.2 重啟 daemon 和 Docker
root@rsecc:~# systemctl daemon-reload root@rsecc:~# systemctl restart docker3.3 檢查加速器是否生效
root@rsecc:~# docker info ……省略…… Registry Mirrors:https://registry.docker-cn.com/Live Restore Enabled: false附錄
Docker 鏡像加速列表
Docker 中國官方鏡像:https://registry.docker-cn.com
科大鏡像站:https://docker.mirrors.ustc.edu.cn
阿里云:https://<your_code>.mirror.aliyuncs.com [需要注冊,獲取專屬的鏡像加速鏈接]
七牛云:https://reg-mirror.qiniu.com
華為云:https://<your_code>.mirror.swr.myhuaweicloud.com [需要注冊,獲取專屬的鏡像加速鏈接]
騰訊云:https://mirror.ccs.tencentyun.com
總結
以上是生活随笔為你收集整理的Docker 安装及镜像加速器配置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux 内核PCI驱动总结记录
- 下一篇: 红警3命令与征服注册激活启动cdkey联