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 // 以交互的模式进入容器

 

posted @   白玉神驹  阅读(360)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
点击右上角即可分享
微信分享提示