阿里雲輕量應用服務器環境搭建-Ubuntu安裝Docker環境
- 工具:XShell
- 服務器:阿里雲輕量應用服務器,Ubuntu 16.04
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
- 配置鏡像加速器
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
- 安裝校驗
docker version
至此,docker環境安裝完成
- Docker查看鏡像
docker images
- Docker在運行的容器中執行命令
docker exec -it 容器名 /bin/bash # 進入
exit # 退出
創作不易,喜歡的話加個關注點個贊,謝謝謝謝謝謝!