关于Docker alpine

1.拉取alpine镜像

docker pull alpine

2.运行镜像成为容器

bash 复制代码
docker run -it --rm alpine sh 

(--rm标志确保容器在退出时被自动删除。)

3.容器建立后,运行

bash 复制代码
docker exec -it  <container_id> sh

4.进入容器里的 alpine环境

①.配置安装源

bash 复制代码
cat >/etc/apk/repositories <<-EOF
https://mirrors.ustc.edu.cn/alpine/edge/main
https://mirrors.ustc.edu.cn/alpine/edge/community
https://mirrors.ustc.edu.cn/alpine/edge/testing
EOF

apk update && apk upgrade

采用用国内阿里云的源,文件内容为:

https://mirrors.aliyun.com/alpine/v3.9/main/

https://mirrors.aliyun.com/alpine/v3.9/community/

如果采用中国科技大学的源,文件内容为

https://mirrors.ustc.edu.cn/alpine/v3.9/main/

https://mirrors.ustc.edu.cn/alpine/v3.9/community/

采用清华源,文件内容为

https://mirror.tuna.tsinghua.edu.cn/alpine/v3.9/main/

https://mirror.tuna.tsinghua.edu.cn/alpine/v3.9/community/

②.安装软件

服务管理系统叫 OpenRC

安装一下 apk add openrc

安装其他软件 apk add curl vim bash bash-completion openssh

③.安装用户管理工具,修改 root 用户的 shell 为 bash,默认使用的是 ash。

apk add shadow

usermod -s /bin/bash root

④.删除软件包命令

apk del XXX

相关推荐
虎头金猫2 天前
4K 视频总卡在公网带宽?用 N1 + OpenList 把网盘播放链路重新理顺
运维·服务器·网络·python·容器·beautifulsoup·pandas
分布式存储与RustFS2 天前
MinIO 官方 Docker 镜像被移除:依赖它的项目该怎么办
docker·云原生·devops·对象存储·minio·分布式存储
AI职业加油站2 天前
AI智能体应用工程师证书:政策红利下的职业新风口
大数据·运维·人工智能·学习·职场发展
此冬歌咏2 天前
K8s 节点故障实战:优雅驱逐 31 秒,硬故障 331 秒,以及那个永远 Pending 的 Pod
运维·k8s
玉&心2 天前
通过Arthas在线诊断K8S中的内存及JVM等使用情况
docker·k8s·arthas
xing-xing2 天前
Docker容器中Nginx站点根目录网页配置访问
nginx·docker
-梅2 天前
linux(8) 软硬链接
linux·运维·服务器
赵文宇(温玉)2 天前
CoreDNS的hosts插件的缺行配置导致k8s集群异常
容器·kubernetes·rancher
guo_wen_qiang2 天前
上传本地镜像到harbor中
docker·容器·持续部署
张洛闻Eren2 天前
k8s云原生【第十课】:水平 Pod 自动扩缩容
运维·数据库·云原生·kubernetes·github