Docker(Ⅸ)-基于官方alpine基础镜像制作自定义镜像

file

//确认工作目录
pwd
/opt/docker/system/alpine

//编写Dockerfile文件
vim Dockerfile

#Alpine Base Image
#
FROM alpine:3.11

LABEL sunxiaobo "952098151@qq.com"

#使用阿里云源方法#
#a.编辑 /etc/apk/repositories#
#b.将里面 dl-cdn.alpinelinux.org 的 改成 mirrors.aliyun.com ; 保存退出即可#                                                                                                                                                              
ADD repositories /etc/apk/repositories

RUN apt update && apk add iotop gcc libgcc libc-dev libcurl libc-utils pcre-dev zlib-dev libnfs make pcre pcre2 zip unzip net-tools pstree wget libevent libevent-dev iproute2

ADD nginx-1.16.1.tar.gz /usr/local/src

RUN cd /usr/local/src/nginx-1.16.1 && ./configure --prefix=/apps/nginx && make && make install && ln -sv /apps/nginx/sbin/nginx /usr/bin/

RUN addgroup -g 980 -S nginx && adduser -s /sbin/nologin -S -D -u 980 -G nginx nginx

ADD nginx.conf /apps/nginx/conf/nginx.conf

ADD static.tar.gz /data/nginx/html

RUN chown nginx.nginx /data/nginx/ /apps/nginx/ -R

EXPOSE 80 443 

CMD ["nginx","-g","daemon off"]
//确认工作目录
pwd
/opt/docker/system/alpine

//编写Dockerfile文件
vim repositories 

#http://dl-cdn.alpinelinux.org/alpine/v3.11/main
#http://dl-cdn.alpinelinux.org/alpine/v3.11/main

http://mirrors.aliyun.com/alpine/v3.11/community
http://mirrors.aliyun.com/alpine/v3.11/community
//确认工作目录
pwd
/opt/docker/system/alpine

//编写Dockerfile文件
vim build-command.sh 

#!/bin/bash
docker build -t nginx-1.16.1:alpine .
点赞

发表回复

电子邮件地址不会被公开。必填项已用 * 标注