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 // 以交互的模式进入容器
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 【自荐】一款简洁、开源的在线白板工具 Drawnix