# Ubuntu中配置

## Ubuntu环境搭建

```shell
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt update
sudo apt upgrade
sudo apt-get install ca-certificates curl gnupg lsb-release
# 添加Docker官方GPG密钥
sudo 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
sudo apt-get install docker-ce docker-ce-cli containerd.io
# 默认情况下，只有root用户和docker组的用户才能运行Docker命令。我们可以将当前用户添加到docker组，以避免每次使用Docker时都需要使用sudo，设置完成后退出当前用户之后再进入既可
sudo usermod -aG docker $USER
# 运行docker
sudo systemctl start docker
# 安装工具
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
# 重启docker
sudo service docker restart
```

> 避免每次操作都要输入`sudo`
>

```bash
# 创建分组一般
sudo groupadd docker
# 将当前用户添加到分组
sudo usermod -aG docker $USER
# 重启终端生效
exit
```

## 安装docker内容
```bash
sudo mkdir /etc/docker
sudo touch /etc/docker/daemon.json
sudo chmod 777 /etc/docker/daemon.json
sudo vim /etc/docker/daemon.json
```

**必要的 deaemon.json**

镜像源会过期：[Docker镜像源](https://www.yuque.com/bunny-6ixda/bgxtva/rh4mkvzegfumrncg)

```json
{
    "registry-mirrors": [
         "https://docker.unsee.tech",
        "https://docker.1panel.live",
         "https:\/\/jockerhub.com",
         "https://dockerhub.icu",
         "https://docker.1panel.live",
         "https://gwsg6nw9.mirror.aliyuncs.com",
         "https://registry.docker-cn.com",
         "http://hub-mirror.c.163.com",
         "http://f1361db2.m.daocloud.io",
         "https://mirror.ccs.tencentyun.com",
         "https://phtv51hj.mirror.aliyuncs.com",
         "https://gwsg6nw9.mirror.aliyuncs.com"
    ]
}
```

重启docker

```bash
sudo systemctl restart docker.socket
```

## 
