docker容器中安装常用命令
docker常用命令
查看debian版本
cat /etc/apt/sources.list

去清华大学开源软件镜像站找到对应版本 bullseye

将系统自带该文件备份
cp /etc/apt/sources.list /etc/apt/sources.list.backup
安装https源
apt install apt-transport-https ca-certificates
更改镜像源
cat>>EOF>/etc/apt/sources.list # 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释 deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free # 中科大镜像源 deb https://mirrors.ustc.edu.cn/ubuntu/ bullseye main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ bullseye main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ bullseye-updates main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ bullseye-updates main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ bullseye-backports main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ bullseye-backports main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ bullseye-security main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ bullseye-security main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ bullseye-proposed main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ bullseye-proposed main restricted universe multiverse # 阿里镜像源 deb http://mirrors.aliyun.com/ubuntu/ bullseye main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bullseye-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bullseye-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bullseye-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bullseye-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bullseye main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bullseye-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bullseye-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bullseye-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bullseye-backports main restricted universe multiverse EOF
更新安装包列表
apt update
其他命令
# 查看所有运行和未运行的容器
docker ps -al
容器保存为镜像
docker commit mymariadb mymariadb-i
镜像备份
docker save -o mymariadb.tar mymariadb-i
镜像恢复与迁移
docker load -i mymariadb.tar #-i 输入的文件
进入容器
docker run -it --rm ubuntu:16.04 bash // 以交互的模式运行容器 docker exec -it ubuntu的容器id bash // 以交互的模式进入容器

浙公网安备 33010602011771号