镜像制作一

以基于 CentOS6.9 制作 nginx 镜像为例

启动 CentOS6.9 容器

docker run -it -p 81:80 centos:6.9 /bin/bash

进入容器操作

换源

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

# 由于镜像是 CentOS6.9 此处更好为阿里云 CentOS6 的源

yum clean all

yum makecache

yum安装nginx

测试nginx

退出容器

提交镜像

查看镜像

测试运行情况

Last updated