Docker安装配置手册
安装Docker(Debian系统)
安装依赖:
apt update apt install ca-certificates curl gnupg
添加仓库(清华源):
install -m 0755 -d /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg sudo chmod a+r /etc/apt/keyrings/docker.gpg echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian \ "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ tee /etc/apt/sources.list.d/docker.list > /dev/null
安装Docker:
apt update apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
验证安装:
docker --version docker compose version
常用命令
进入容器:docker exec -it <容器id> /bin/bash
保存镜像:docker save <镜像名>:<镜像标签> | gzip > /home/<存储名称>.tar.gz
查看日志:docker logs <容器id>