构建自己的docker镜像
创建目录
mkdir -p /home/kejilion/php && cd /home/kejilion/php
创建Dockerfile
nano Dockerfile
配置
FROM php:fpm
RUN apt update && apt install -y curl
RUN mkdir -p /usr/local/bin/
RUN curl -sL https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions -o /usr/local/bin/install-php-extensions
RUN chmod +x /usr/local/bin/install-php-extensions
RUN install-php-extensions mysqli gd intl zip opcache exif imagick redis pdo_mysql bcmath
RUN echo "upload_max_filesize=50M\npost_max_size=50M" > /usr/local/etc/php/conf.d/uploads.ini
RUN echo "memory_limit=256M" > /usr/local/etc/php/conf.d/memory.ini
RUN echo "max_execution_time=1200" > /usr/local/etc/php/conf.d/max_execution_time.ini
RUN echo "max_input_time=600" > /usr/local/etc/php/conf.d/max_input_time.ini
CMD ["php-fpm"]
构建镜像
docker login
docker buildx create --use
docker buildx build --platform linux/amd64,linux/arm/v5 -t kjlion/php:8.3 .
docker push kjlion/php:8.3
这个镜像主要实现什么功能?能不能一步一步解析一下dockerfile的每一行命令?我最近有点想学dockerfile。
回复删除