编写dockerfile文件
FROM ubuntu:latest
MAINTAINER jypony
RUN apt-get update && apt-get upgrade && apt-get -y install software-properties-common && add-apt-repository ppa:ondrej/php && apt-get -y update && apt-get install -y php8.1-fpm vim php8.1-bcmath php8.1-curl php8.1-mcrypt php8.1-mysql php8.1-pgsql php8.1-redis php8.1-zip php8.1-mbstring
COPY ./www.conf /etc/php/8.1/fpm/pool.d/www.conf
RUN mkdir /run/php && touch /run/php/php8.1-fpm.pid
EXPOSE 9000
RUN useradd -ms /bin/bash centos
RUN usermod -u 1000 centos && groupmod -g 1000 centos
CMD ["bash", "-c", "/usr/sbin/php-fpm8.1 -y /etc/php/8.1/fpm/php-fpm.conf -c /etc/php/8.1/cli/php.ini -F"]
编译镜像
docker build -t jy/php81:v1 .
运行容器
docker run -id --name php81 --security-opt seccomp=unconfined -v /home/centos/htdocs:/var/www/htdocs 836359257/php-fpm8.1:v1
--security-opt seccomp=unconfined参数是当用户权限不足时使用
评论 (0)