ubuntu安装docker和docker-compose
由于我的很多帖子都是使用docker-compose进行演示的,有些同学对此不是很熟悉,所以本文介绍一下如何在ubuntu上安装docker和docker-compose。一、apt更换为阿里源Ubuntu16:(1) 备份/etc/apt/sources.list$:cp /etc/apt/sources.list /etc/apt/sources...
由于我的很多帖子都是使用docker-compose进行演示的,有些同学对此不是很熟悉,所以本文介绍一下如何在ubuntu上安装docker和docker-compose。
一、apt更换为阿里源
Ubuntu16:
(1) 备份 /etc/apt/sources.list
$: cp /etc/apt/sources.list /etc/apt/sources.list.bakcup
(2)将以下内容写入/etc/apt/sources.list
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
Ubuntu14:
(1) 备份 /etc/apt/sources.list
$: cp /etc/apt/sources.list /etc/apt/sources.list.bakcup
(2)将以下内容写入/etc/apt/sources.list
deb http://mirrors.aliyun.com/ubuntu trusty main restricted
deb-src http://mirrors.aliyun.com/ubuntu trusty main restricted
deb http://mirrors.aliyun.com/ubuntu trusty-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu trusty-updates main restricted
deb http://mirrors.aliyun.com/ubuntu trusty universe
deb-src http://mirrors.aliyun.com/ubuntu trusty universe
deb http://mirrors.aliyun.com/ubuntu trusty-updates universe
deb-src http://mirrors.aliyun.com/ubuntu trusty-updates universe
deb http://mirrors.aliyun.com/ubuntu trusty multiverse
deb-src http://mirrors.aliyun.com/ubuntu trusty multiverse
deb http://mirrors.aliyun.com/ubuntu trusty-updates multiverse
deb-src http://mirrors.aliyun.com/ubuntu trusty-updates multiverse
deb http://mirrors.aliyun.com/ubuntu trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu trusty-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu trusty-security main
deb-src http://mirrors.aliyun.com/ubuntu trusty-security main
deb http://mirrors.aliyun.com/ubuntu trusty-security universe
deb-src http://mirrors.aliyun.com/ubuntu trusty-security universe
二、安装docker
$: sudo apt-get update
$: sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
-- 安装GPG证书
$: curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
-- 写入软件源信息
$: sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
-- 更新并安装 Docker-CE
$: sudo apt-get -y update
$: sudo apt-get -y install docker-ce
-- 镜像加速
$: sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://f3zh23hq.mirror.aliyuncs.com"]
}
EOF
$: sudo systemctl reload docker
官方参考: https://docs.docker.com/install/linux/docker-ee/ubuntu/
三、安装docker-compose
$: curl -L https://get.daocloud.io/docker/compose/releases/download/1.19.0/docker-compose-`uname -s`-`uname -m` | sudo tee /usr/local/bin/docker-compose > /dev/null
$: sudo chmod +x /usr/local/bin/docker-compose
可以根据需要选择适合自己的版本
更多推荐
所有评论(0)