title: Docker meta:
- name: description Content: EasySwoole docker image build
- name: keywords Content: swoole|swoole extension|swoole framework|easyswoole|swoole docker image|swoole dockerfile
Docker
- GitHub Leave a star if you like
- GitHub for Doc
docker pull
docker pull easyswoole/easyswoole3
::: warning The environment on the docker hub is php7.1.30 + swoole4.4.3 :::
Start up
docker run -ti -p 9501:9501 easyswoole/easyswoole3
The default working directory is: /easyswoole. When the above command is started, it automatically enters the working directory, executes php easyswoole start, and the browser accesses http://127.0.0.1:9501/ You can see the easyswoole welcome page.
Docker File
You can also use Docker file for automatic builds.
FROM centos:latest#version definedENV SWOOLE_VERSION 4.4.3ENV EASYSWOOLE_VERSION 3.x-dev#update coreRUN yum update -y#install libsRUN yum install -y curl zip unzip wget openssl-devel gcc-c++ make autoconf#install phpRUN yum install -y epel-releaseRUN rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpmRUN yum clean allRUN yum update -yRUN yum install -y php71w-devel php71w-openssl php71w-gd php71w-mbstring php71w-mysqli# composerRUN curl -sS https://getcomposer.org/installer | php \&& mv composer.phar /usr/bin/composer \&& composer self-update --clean-backups# use aliyun composerRUN composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/# swoole extRUN 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" /etc/php.ini \&& rm -r swoole# DirWORKDIR /easyswoole# install easyswooleRUN cd /easyswoole \&& composer require easyswoole/easyswoole=${EASYSWOOLE_VERSION} \&& php vendor/bin/easyswoole installEXPOSE 9501
