构建Ubuntu unminimized的docker镜像

前言

最近需要回顾一下Linux环境的Bash命令。使用 Docker 是快速搭建 Linux 环境的最佳方式,只需运行以下命令即可获取并启动一个 Ubuntu 容器:

docker pull ubuntu
docker run -it ubuntu 

然而,Docker Hub 提供的官方 Ubuntu 镜像是一个最小化版本(minimized version)。该镜像专为应用程序部署设计,仅包含必要的运行文件,删除了许多用于交互的软件包。例如,当运行 man 命令时,会提示:

This system has been minimized by removing packages and content that are not required on a system that users do not log into.

To restore this content, you can run the ‘unminimize’ command.
root@6ac67a73f171:/# man man
This system has been minimized by removing packages and content that are
not required on a system that users do not log into.
To restore this content, including manpages, you can run the ‘unminimize’
command. You will still need to ensure the ‘man-db’ package is installed

为了提升交互体验,我们将在官方 Ubuntu 最小镜像的基础上,安装必要的软件包,构建一个可用于日常操作的 Ubuntu 镜像。

使用dockerfile

Dockerfile内容如下:

ARG TAG
From ubuntu:$TAG

# set up DEBIAN_FRONTEND to avoid configuring tzdata
ENV DEBIAN_FRONTEND noninteractive

# 运行unminimize命令
RUN apt-get update && apt-get install -y unminimize &&  yes | unminimize 

# 安装以下文件包:
# - vim编辑文件
# - man命令使用指南
# - iproute2 is the modern replacement for the old net-tools package and is the standard for network management in modern Linux distributions. It includes commands eg. ss, ip
# - netcat
# - python v3
RUN apt-get install 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

liyane

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值