Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build a swoole docker image

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "how to build a swoole docker image". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to build a swoole docker image".

By default here, you have installed docker and prepared the following environment

one。 Environment

Ubuntu 18.04.1 LTS

Php:7.2.4-cli-alpine3.7 (https://hub.docker.com/_/php/ pull)

Swoole-4.2.1 (https://pecl.php.net/package/swoole download)

Docker version

Docker versionClient:Version: 18.05.0-ceAPI version: 1.37Go version: go1.9.5Git commit: f150324Built: Wed May 9 22:16:13 2018OS/Arch: linux/amd64Experimental: falseOrchestrator: swarm Server:Engine:Version: 18.05.0-ceAPI version: 1.37 (minimum version 1.12) Go version: go1.9.5Git commit: f150324Built: Wed May 9 22:14:23 2018OS/Arch: linux/amd64Experimental: false II. Build $mkdir build-swoole & & cd build-swoole$ vi dockerfile based on pecl

Write the following in Dockerfile

FROM php:7.2.4-cli-alpine3.7RUN echo http://mirrors.ustc.edu.cn/alpine/v3.7/main > / etc/apk/repositories & &\ echo http://mirrors.ustc.edu.cn/alpine/v3.7/community > > / etc/apk/repositoriesRUN apk update & & apk upgradeRUN apk add M4 autoconf make gcc gaming + linux-headersRUN pecl install swoole-4.2.1RUN docker-php-ext-enable swooleCMD\ ["php" "- m"\] $docker build-no-cache-t php:7.2.4-swoole-alpine3.7.

Due to the network and other reasons, the way to build based on pecl sometimes succeeds and sometimes fails. Here is a more stable way to build

three。 Build $mkdir-p build-swoole/install & & cd build-swoole$ wget-c https://pecl.php.net/get/swoole-4.2.1.tgz-P. / install$ vi Dockerfile by compiling

Write the following in Dockerfile

FROM php:7.2.4-cli-alpine3.7RUN echo http://mirrors.ustc.edu.cn/alpine/v3.7/main > / etc/apk/repositories & &\ echo http://mirrors.ustc.edu.cn/alpine/v3.7/community > > / etc/apk/repositoriesRUN apk update & & apk upgradeRUN apk add M4 autoconf make gcc gaming + linux-headersADD. / install/swoole-4.2.1.tgz / tmp/RUN cd / tmp/swoole-4.2.1 & & phpize & &. / configure & & make & & make installRUN docker-php-ext-install pdo_mysqlRUN docker-php-ext-enable swooleCMD\ ["php" "- m"\] $docker build-no-cache-t php:7.2.4-swoole-alpine3.7.

Tips: I added the pdo_mysql extension to dockerfile

Check whether $docker run-it-- rm-- name swoole php:7.2.4-swoole-alpine3.7 sh-c "php-m | grep swoole" swoole has been built successfully

The presence of swoole indicates that the construction is successful

Thank you for reading, the above is the content of "how to build a swoole docker image". After the study of this article, I believe you have a deeper understanding of how to build a swoole docker image, and the specific usage needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report