构建1个具有日常工具的开发镜像

使用docker构建1个具有常用工具的开发镜像, 避免每次安装各种工具, 导致污染了本机环境

相关文件

sources.list如下

1
2
3
4
5
[root@VM-24-4-ubuntu dev]$ ===>>> cat sources.list
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse

Dockerfile如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
FROM harbor.kengdie.xyz/k8s/library/ubuntu:22.04

COPY sources.list /etc/apt/sources.list

ENV CODEUSER root
ENV CODEPASS Admin12345..

RUN apt update && \
apt install -y net-tools iputils-ping iproute2 openssh-server curl vim wget git python3 python3-pip && \
ln -s /usr/bin/python3 /usr/bin/python && \
python -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip && \
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && \
curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && \
apt install -y nodejs && \
npm set registry https://registry.npm.taobao.org && \
npm install -g yarn && \
apt autoremove && \
apt autoclean && \
apt clean && \
rm -rf /tmp/* && \
rm -rf /var/tmp/* && \
rm -rf /var/lib/apt/lists/* && \
mkdir /run/sshd && \
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config && \
sed -i "s/#UseDNS.*/UseDNS no/g" /etc/ssh/sshd_config && \
echo $CODEUSER:$CODEPASS | chpasswd

WORKDIR /code
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]

构建

1
docker build . --no-cache -t ubuntu:20230815-dev01
作者

好方

发布于

2024-04-08

更新于

2024-05-10

许可协议