在Ubuntu上安装docker
1.卸载旧版本
sudo apt-get remove docker docker-engine docker.io containerd runc
1..更新apt软件包索引并安装软件包以允许apt通过HTTPS使用存储库:
sudo apt-get update sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg-agent \ software-properties-common
2.添加Docker的官方GPG密钥:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
3.使用以下命令来设置稳定的存储库
sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable"
1.更新apt
程序包索引,并安装最新版本的Docker Engine和容器
sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io
2.通过运行hello-world
映像来验证是否正确安装了Docker Engine
sudo docker run hello-world
3.将非root用户加入docker组,以允许免sudo
执行docker
sudo usermod -aG docker your-user
4.更新用户组
newgrp docker
配置docker开机自启
sudo systemctl enable docker
禁止自启,请用disable
sudo systemctl disable docker
输入docker 查看docker命令
docker
启动docker
systemctl start docker
停止docker
systemctl stop docker
查看docker状态
systemctl status docker
无穷的伟大,也是从“0”开始的