Ubuntu基础镜像制作

dockerfile制作Ubuntu基础镜像

apt源文件内容

[root@localhost ubuntu]# cat 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

dockerfile

[root@localhost ubuntu]# cat Dockerfile 
#dockerfile ubuntu-base is image
FROM ubuntu:18.04
LABEL mail=timerovers@163.com

ENV LANG="zh_CN.utf8"

#apt源
COPY sources.list /etc/apt/sources.list
#时区
RUN apt update \
    && apt -y install tzdata \
    && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
    && apt install -y language-pack-zh-hans \
    && apt-get clean

构建以及启动

docker build -t ubuntu-base:18.04 .
docker run -d -it --name ubuntu-base ubuntu-base:18.04 bash

大小

[root@localhost ~]# docker images
REPOSITORY                                          TAG                 IMAGE ID            CREATED             SIZE
ubuntu-base                                              18.04                c33ef0a9250b        30 seconds ago      127MB
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容