# ubuntu安装Docker & Docker-compose


<!--more-->


# # 安装docker

## ## 0x01 卸载已安装版本

> sudo apt-get remove docker docker-engine docker.io

## ## 0x02 更新源

> apt-get update

## ## 0x03 安装依赖

```json
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common
```

## ## 0x04 添加官方密钥

> curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

## ## 0x05 添加仓库

```json
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
```

## ## 0x06 再次更新源

> apt-get update

## ## 0x07 安装docker

> apt-get install docker-ce

## ## 0x08 查看版本

> docker -v 

# # 安装docker-compose

## ## 0x01 安装脚本

```json
curl -L https://github.com/docker/compose/releases/download/1.24.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
```

## ## 0x02 授权

> sudo chmod +x /usr/local/bin/docker-compose

## ## 0x03 查看版本信息

> docker-compose --version
