Ubuntu和Debian通过ppa安装最新版本的docker
Ubuntu
#!/bin/bash # Check for software-properties-common package if ! command -v add-apt-repository &> /dev/null; then echo "Package 'software-properties-common' not found. Installing..." sudo apt update sudo apt install -y software-properties-common fi # Check CPU architecture and set variables accordingly if [[ $(arch) == "aarch64" ]]; then DOCKER_ARCH="arm64" else DOCKER_ARCH="amd64" fi # Add Docker PPA sudo add-apt-repository "deb [arch=${DOCKER_ARCH}] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - # Update package list sudo apt update # Install Docker sudo apt install docker-ce docker-ce-cli containerd.io # Add current user to the docker group so that sudo is not required for every Docker command # sudo usermod -aG docker $USER
Debian
#!/bin/bash # Install curl、gnupg和docker-compose sudo apt-get -y update && sudo apt-get -y install curl gnupg lsb-release ARCH=$(dpkg --print-architecture) curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt update sudo apt install docker-ce docker-ce-cli containerd.io
本文作者:phae
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!