镜像
vim sources.list
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
vim Dockerfile
FROM ubuntu:18.04
ENV LANG C.UTF-8
COPY sources.list /etc/apt/sources.list
RUN apt update && apt install -y \
iputils-ping \
net-tools \
&& rm -rf /var/lib/apt/lists/*
docker build -t hello:v1.0 .
hello.yaml
apiVersion: v1
kind: Pod
metadata:
name: hello
spec:
containers:
- name: hello-c
image: hello:v1.0
volumeMounts:
- name: tz-config
mountPath: /etc/localtime
readOnly: true
resources:
limits:
memory: "200Mi"
requests:
memory: "100Mi"
command: ['sh', '-c', 'while true; do echo "hello"; sleep 10; done']
volumes:
- name: tz-config
hostPath:
path: /usr/share/zoneinfo/Asia/Shanghai