关于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

相关推荐
SkyWalking中文站10 小时前
认识 Horizon UI · 5/17:3D 基础设施地图
运维·监控·自动化运维
SkyWalking中文站1 天前
认识 Horizon UI · 1/17:SkyWalking 新一代可观测性控制台
运维·前端·监控
雪梨酱QAQ1 天前
Kubeneters HA Cluster部署
运维
lichenyang4532 天前
Docker 学习笔记(五):Docker Compose,用一个 YAML 启动前端、后端和 MongoDB
docker
lichenyang4532 天前
Docker 学习笔记(四):Dockerfile,把项目打成自己的镜像
docker·容器
lichenyang4532 天前
Docker 学习笔记(三):Docker 网络、bridge、子网和容器互通
docker·容器
lichenyang4532 天前
Docker 学习笔记(二):docker run 的参数到底在控制什么?
docker·容器
江华森2 天前
Spring Cloud 微服务全栈实战:从 Eureka 到 Docker Compose 一文贯通
运维
江华森2 天前
Matplotlib 数据绘图基础入门
运维
江华森2 天前
NumPy 数值计算基础入门
运维