创意电子

标题: 构建php扩展swoole的运行情况docker镜像 [打印本页]

作者: 宸宸辉    时间: 2021-9-27 15:00
标题: 构建php扩展swoole的运行情况docker镜像
mkdir Dockerfilecd Dockerfile/touch dockerfilevi dockerfilei //插入dockerfile内容
FROM centos:8 #version definedENV SWOOLE_VERSION 4.4.23 #install libsRUN yum -y updateRUN yum install -y curl zip unzip  wget openssl-devel gcc-c++ make autoconf git passwd#install phpRUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpmRUN rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-8.rpmRUN yum install -y php74 php74-php php74-php-devel php74-php-bcmath php74-php-cli php74-php-common php74-php-gd php74-php-json php74-php-mbstring php74-php-xmlRUN rm -rf /usr/bin/php && ln -s /opt/remi/php74/root/usr/bin/php /usr/bin/php\    && rm -rf /usr/bin/phpize &&  ln -s /opt/remi/php74/root/usr/bin/phpize /usr/bin/phpize\    && rm -rf /usr/bin/php-config &&  ln -s /opt/remi/php74/root/usr/bin/php-config /usr/bin/php-config # composerRUN curl -sS https://getcomposer.org/installer | php \    && mv composer.phar /usr/bin/composer && chmod +x /usr/bin/composer# use aliyun composerRUN composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/CMD ["systemctl","restart","sshd"]#安装ssh服务RUN yum install -y openssh-serverRUN mkdir -p /var/run/sshdRUN mkdir -p /root/.ssh#取消pam限制RUN sed -ri \"s/session required pam_loginuid.so/#session required pam_loginuid.so/g" /etc/pam.d/sshd RUN wget https://github.com/swoole/swoole-src/archive/v${SWOOLE_VERSION}.tar.gz -O swoole.tar.gz \    && mkdir -p swoole \    && tar -xf swoole.tar.gz -C swoole --strip-components=1 \    && rm swoole.tar.gz \    && ( \    cd swoole \    && phpize \    && ./configure --enable-openssl \    && make \    && make install \    ) \    && sed -i "2i extension=swoole.so" `php -i | grep php.ini |  awk -F "=>" '{print $2}' |grep php.ini` \    && rm -r swoole # DirVOLUME /workWORKDIR /work EXPOSE 9501 22Esc
:wq
构建镜像
docker build -t easyswoole -f dockerfile .查看easyswoole镜像
docker images启动一个easyswoole容器
docker run -itd --privileged \ --name=easyswoole -p 0.0.0.0:9502:9502 -v /work:/work \ easyswoole /usr/sbin/init查看easyswoole容器
docker ps




欢迎光临 创意电子 (https://wxcydz.cc/) Powered by Discuz! X3.4