阿里雲輕量應用服務器環境搭建-Ubuntu安裝Docker環境

阿里雲輕量應用服務器環境搭建-Ubuntu安裝Docker環境

  • 工具:XShell
  • 服務器:阿里雲輕量應用服務器,Ubuntu 16.04

參考鏈接:https://yq.aliyun.com/articles/110806

Ubuntu安裝Docker環境

  • step 1: 安裝系統工具
sudo apt-get update

在這裏插入圖片描述

sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common 

在這裏插入圖片描述

  • step 2:安裝GPG證書
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -

在這裏插入圖片描述

  • step 3:寫入軟件源信息
sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"

在這裏插入圖片描述

  • Step 4:更新並安裝Docker-CE
sudo apt-get -y update

在這裏插入圖片描述

sudo apt-get -y install docker-ce

在這裏插入圖片描述

  • Docker CE 鏡像源站——使用官方安裝腳本自動安裝 (僅適用於公網環境)
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

[外鏈圖片轉存失敗,源站可能有防盜鏈機制,建議將圖片保存下來直接上傳(img-lDozon1X-1593748308817)(markdown-img/image-20200310223419036.png)]

  • 配置鏡像加速器
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://zbe10alu.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

[外鏈圖片轉存失敗,源站可能有防盜鏈機制,建議將圖片保存下來直接上傳(img-vfZQm8wt-1593748308819)(markdown-img/image-20200310223629298.png)]

  • 安裝校驗
docker version

[外鏈圖片轉存失敗,源站可能有防盜鏈機制,建議將圖片保存下來直接上傳(img-bbgfPehA-1593748308820)(markdown-img/image-20200310223757055.png)]

至此,docker環境安裝完成

  • Docker查看鏡像
docker images

在這裏插入圖片描述

  • Docker在運行的容器中執行命令

參考:https://www.runoob.com/docker/docker-exec-command.html

docker exec -it 容器名 /bin/bash  # 進入

exit # 退出

創作不易,喜歡的話加個關注點個贊,謝謝謝謝謝謝!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章