linux安装、卸载 Docker 本文共有3708个字,关键词: 最新 安装工具 ``` sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common ``` 执行以下命令来添加Docker官方的GPG密钥: ``` curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add - ``` 执行以下命令来添加Docker的软件源: ``` sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable" ``` 执行以下命令来安装Docker: ``` apt-get install docker-ce docker-ce-cli containerd.io ``` 将当前用户添加到docker组,以避免每次使用Docker时都需要使用sudo。命令如下: ``` sudo usermod -aG docker $USER ``` 启动 ``` systemctl start docker ``` from https://docs.docker.com/engine/install/ubuntu/ 为了避免每次命令都输入sudo,可以设置用户权限,注意执行后须注销重新登录 ```bash sudo usermod -a -G docker $USER ``` #####安装docker-compose ``` #https://github.com/docker/compose/releases curl -L https://github.com/docker/compose/releases/download/v2.29.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose curl -L https://get.daocloud.io/docker/compose/releases/download/v2.29.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose # 添加可执行权限 sudo chmod +x /usr/local/bin/docker-compose # 查看docker-compose版本 docker-compose -v ``` 一句话搞定: curl -fsSL https://get.docker.com | bash -s docker —mirror Aliyun ```bash #ubuntu sudo apt-get remove docker docker-engine docker.io containerd runc sudo apt-get update sudo apt-get install -y ca-certificates curl gnupg lsb-release sudo mkdir -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin ``` ```bash #另存.sh 执行 sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine sudo yum install -y yum-utils sudo yum-config-manager \ —add-repo \ https://download.docker.com/linux/centos/docker-ce.repo sudo yum install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin sudo systemctl start docker sudo systemctl enable docker sudo systemctl status docker ``` ```bash sudo yum-config-manager \ --add-repo \ http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo ``` ####UOS ```bash cat /etc/product-info cat /etc/os-version cat /etc/debian_version sudo apt-get remove docker docker-engine docker.io containerd runc sudo apt-get update sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg2 \ software-properties-common #绕过ssl验证的方法如下: echo "Acquire::https::Verify-Peer "false";" >> /etc/apt/apt.conf.d/80ssl-exceptions echo "Acquire::https::Verify-Host "false";" >> /etc/apt/apt.conf.d/80ssl-exceptions 添加docker官方证书 curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add - #sudo apt-key fingerprint 0EBFCD88 vim /etc/apt/source.list,在最后添加docker源 echo "deb [arch=amd64] https://download.docker.com/linux/debian buster stable" >> /etc/apt/sources.list #更新源,然后安装docker-ce sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io ``` [docker配置镜像加速器](/index.php/archives/51/ "docker配置镜像加速器") 「一键投喂 软糖/蛋糕/布丁/牛奶/冰阔乐!」 赞赏 × 梦白沙 (๑>ڡ<)☆谢谢老板~ 1元 2元 5元 10元 50元 任意金额 2元 使用微信扫描二维码完成支付 版权声明:本文为作者原创,如需转载须联系作者本人同意,未经作者本人同意不得擅自转载。 ubuntu系统,Docker 2022-04-11 评论 377 次浏览