linux ubuntu setup docker--Ubuntu Noble 24.04 (LTS)
检查删除旧的dockersudo apt remove $(dpkg --get-selections docker.io docker-compose docker-compose-v2 docker-doc podman-docker containerd runc | cut -f1)setup apt repository# Add Dockers official GPG key:sudoaptupdatesudoaptinstallca-certificatescurlsudoinstall-m0755-d/etc/apt/keyringssudocurl-fsSLhttps://download.docker.com/linux/ubuntu/gpg-o/etc/apt/keyrings/docker.ascsudochmodar /etc/apt/keyrings/docker.asc# Add the repository to Apt sources:sudotee/etc/apt/sources.list.d/docker.sourcesEOF Types: deb URIs: https://download.docker.com/linux/ubuntu Suites:$(./etc/os-releaseecho${UBUNTU_CODENAME:-$VERSION_CODENAME})Components: stable Architectures:$(dpkg --print-architecture)Signed-By: /etc/apt/keyrings/docker.asc EOFsudoaptupdate安装最后版本sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin指定版本apt list --all-versions docker-ceVERSION_STRING5:29.4.1-1ubuntu.24.04noblesudoaptinstalldocker-ce$VERSION_STRINGdocker-ce-cli$VERSION_STRINGcontainerd.io docker-buildx-plugin docker-compose-plugin验证sudo systemctl status docker启动sudo systemctl start docker// sudo docker run hello-world 验证dockerPortainersetupdocker pull portainer/portainer-ce:latest运行docker run -d --name portainer -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v /app/portainer_data:/data --restart always --privilegedtrue portainer/portainer-ce:latest访问http://localhost:9000/compose安装setupcompose v1sudo apt intall docker-composecompose v2sudo apt install docker-compose-plugin查看版本compose v1docker-compose -versioncompose v2docker compose -version