安装docker
基本上参考官网就行了
https://docs.docker.com/engine/
Ubuntu 安装docker
先安装前置工具
1 2 3 4
| $ sudo apt-get update
$ sudo apt-get install ca-certificates curl gnupg
|
下载gpg文件
1 2 3 4 5
| $ sudo install -m 0755 -d /etc/apt/keyrings
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
$ sudo chmod a+r /etc/apt/keyrings/docker.gpg
|
添加apt源
1 2 3 4
| echo \ "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
更新,安装docker
1 2
| sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
centos 安装docker
安装repo源
1 2 3 4
| $ sudo yum install -y yum-utils
$ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
|
安装docker
1 2
| $ sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
启动docker,设置开机自启动
1 2 3 4
| $ sudo systemctl start docker $ sudo systemctl enable docker
|