ninghao / nest Goto Github PK
View Code? Open in Web Editor NEW使用 Docker 创建一个本地的运行 PHP 应用的开发环境。
Home Page: https://ninghao.net
使用 Docker 创建一个本地的运行 PHP 应用的开发环境。
Home Page: https://ninghao.net
环境
mac ox 10.12.2
Docker version 1.13.0, build 49bf474
docker-machine version 0.9.0, build 15fd4c7
docker-compose build
unison uses an image, skipping
phpmyadmin uses an image, skipping
redis uses an image, skipping
db uses an image, skipping
Building php
Step 1/7 : FROM php:7.0-fpm
---> a5efceb74f9f
Step 2/7 : MAINTAINER wanghao <[email protected]>
---> Using cache
---> dcc1fc5c0319
Step 3/7 : ENV PHPREDIS_VERSION 3.0.0
---> Using cache
---> c891158b7764
Step 4/7 : RUN curl -L -o /tmp/redis.tar.gz https://github.com/phpredis/phpredis/archive/$PHPREDIS_VERSION.tar.gz && tar xfz /tmp/redis.tar.gz && rm -r /tmp/redis.tar.gz && mv phpredis-$PHPREDIS_VERSION /usr/src/php/ext/redis
---> Running in f8fbb6e1e6cd
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 124 0 124 0 0 9 0 --:--:-- 0:00:13 --:--:-- 28
100 191k 100 191k 0 0 9887 0 0:00:19 0:00:19 --:--:-- 50144
mv: cannot move 'phpredis-3.0.0' to '/usr/src/php/ext/redis': No such file or directory
ERROR: Service 'php' failed to build: The command '/bin/sh -c curl -L -o /tmp/redis.tar.gz https://github.com/phpredis/phpredis/archive/$PHPREDIS_VERSION.tar.gz && tar xfz /tmp/redis.tar.gz && rm -r /tmp/redis.tar.gz && mv phpredis-$PHPREDIS_VERSION /usr/src/php/ext/redis' returned a non-zero code: 1
你好php:5.6-fpm 安装openssl zlib报Cannot find config.m4请问怎么解决呢我的配置如下
FROM php:5.6-fpm
MAINTAINER
ENV PHPREDIS_VERSION 2.2.8
RUN mkdir -p /usr/src/php/ext/redis
&& curl -L https://github.com/phpredis/phpredis/archive/$PHPREDIS_VERSION.tar.gz | tar xvz -C /usr/src/php/ext/redis --strip 1
&& echo 'redis' >> /usr/src/php-available-exts
&& docker-php-ext-install redis
RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak &&
echo "deb http://mirrors.163.com/debian/ jessie main non-free contrib" >/etc/apt/sources.list &&
echo "deb http://mirrors.163.com/debian/ jessie-proposed-updates main non-free contrib" >>/etc/apt/sources.list &&
echo "deb-src http://mirrors.163.com/debian/ jessie main non-free contrib" >>/etc/apt/sources.list &&
echo "deb-src http://mirrors.163.com/debian/ jessie-proposed-updates main non-free contrib" >>/etc/apt/sources.list
RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev
libxml2-dev libfreetype6-dev libmcrypt-dev php5-dev autoconf
libbz2-dev automake libtool m4
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-configure gd --with-png-dir=/usr/include --with-jpeg-dir=/usr/include --with-freetype-dir=/usr/include --with-openssl-dir=/usr/include
--with-freetype-dir=/usr/include --with-libxml-dir=/usr/include
&& docker-php-ext-install bz2 gd mysqli pdo_mysql zip opcache redis openssl zlib curl xmlrpc mcrypt iconv
ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --enable-mbstring --enable-sockets --enable-gd-native-ttf --enable-zip --enable-xml --enable-sysvsem --enable-soap --enable-pcntl --enable-cli --enable-sysvshm --enable-shared --enable-opcache
使用sudo docker-compose up 启动服务后, 在宿主机 怎么样使用console的 里面的php composer呢?
Docker for Windows 版本:
Client:
Version: 1.12.0
API version: 1.24
Go version: go1.6.3
Git commit: 8eab29e
Built: Thu Jul 28 21:15:28 2016
OS/Arch: windows/amd64
Server:
Version: 1.12.0
API version: 1.24
Go version: go1.6.3
Git commit: 8eab29e
Built: Thu Jul 28 21:15:28 2016
OS/Arch: linux/amd64
Docker Daemon 配置如图:
上面这个是 Docker 默认的配置。
下面这个是我的阿里云容器加速器镜像:
执行 docker-compose build
报错如下(下面无法正常显示的字符都是 ← 箭头):
Loyalsoldier@Loyalsoldier-PC MINGW64 /d/dev/docker/nest (master)
$ docker-compose build
phpmyadmin uses an image, skipping
redis uses an image, skipping
db uses an image, skipping
Building php
Step 1 : FROM php:7.0-fpm
7.0-fpm: Pulling from library/php
�[0Ba8c3d80b: Pulling fs layer
�[0B7f80f73d: Pulling fs layer
�[0B1ad560e1: Pulling fs layer
�[0B18962010: Pulling fs layer
�[0B840b656b: Pulling fs layer
�[0B85a7aa1b: Pulling fs layer
�[0Bad85eeda: Pulling fs layer
�[0Bc9ac406d: Pulling fs layer
Digest: sha256:863e1098a358898aa8c0f189d225267113dcb96f00762c9452d4bebb5fe752b27.689 kB/7.689 kBB
Status: Downloaded newer image for php:7.0-fpm
---> 0073e714952e
Step 2 : MAINTAINER wanghao <[email protected]>
---> Running in ad8a8d1af438
---> 545ea49c10ae
Removing intermediate container ad8a8d1af438
Step 3 : ENV PHPREDIS_VERSION 3.0.0
---> Running in 36fc23fe7dda
---> 49110982b266
Removing intermediate container 36fc23fe7dda
Step 4 : RUN curl -L -o /tmp/redis.tar.gz https://github.com/phpredis/phpredis/archive/$PHPREDIS_VERSION.tar.gz && tar xfz /tmp/redis.tar.gz && rm -r /tmp/redis.tar.gz && mv phpredis-$PHPREDIS_VERSION /usr/src/php/ext/redis
---> Running in 0a138266a469
�[91m % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 124 0 124 0 0 8 0 --:--:-- 0:00:14 --:--:-- 29�[0m�[91m�[0m�[91m
9 191k 9 19180 0 0 428 0 0:07:38 0:00:44 0:06:54 3592�[0m�[91m 9 191k 9 19180 0 0 419 0 0:07:48 0:00:45 0:07:03 3279�[0m�[91m 9 191k 9 19180 0 0 410 0 0:07:59 0:00:46
0:07:13 3049�[0m�[91m 11 191k 11 23290 0 0 486 0 0:06:44 0:00:47 0:05:57 1795�[0m�[91m 13 191k 13 27400 0 0 565 0 0:05:47 0:00:48 0:04:59 2272�[0m�[91m 19 191k 19 38440 0 0 777
0 0:04:12 0:00:49 0:03:23 4087�[0m�[91m 23 191k 23 45290 0 0 894 0 0:03:39 0:00:50 0:02:49 5342�[0m�[91m 27 191k 27 53510 0 0 1029 0 0:03:10 0:00:51 0:02:19 6526�[0m�[91m 29 191k 29
57620 0 0 1095 0 0:02:59 0:00:52 0:02:07 7302�[0m�[91m 34 191k 34 68580 0 0 1285 0 0:02:32 0:00:53 0:01:39 8398�[0m�[91m 38 191k 38 75430 0 0 1379 0 0:02:22 0:00:54 0:01:28 7064
�[0m�[91m 39 191k 39 78170 0 0 1396 0 0:02:20 0:00:55 0:01:25 6136�[0m�[91m 40 191k 40 79540 0 0 1412 0 0:02:19 0:00:56 0:01:23 6012�[0m�[91m 46 191k 46 90500 0 0 1564 0 0:02:05
0:00:57 0:01:08 6254�[0m�[91m 48 191k 48 95756 0 0 1615 0 0:02:01 0:00:59 0:01:02 4588�[0m�[91m 50 191k 50 98496 0 0 1649 0 0:01:59 0:00:59 0:01:00 4602�[0m�[91m 55 191k 55 106k 0
0 1812 0 0:01:48 0:01:00 0:00:48 7097�[0m�[91m 66 191k 66 128k 0 0 2138 0 0:01:31 0:01:01 0:00:30 10165�[0m�[91m 82 191k 82 158k 0 0 2604 0 0:01:15 0:01:02 0:00:13 15653�[0m�[91m 93 1
91k 93 180k 0 0 2900 0 0:01:07 0:01:03 0:00:04 20261�[0m�[91m 94 191k 94 181k 0 0 2888 0 0:01:08 0:01:04 0:00:04 18695�[0m�[91m100 191k 100 191k 0 0 3050 0 0:01:04 0:01:04 --:--
:-- 21772
�[0m�[91mmv: �[0m�[91mcannot move 'phpredis-3.0.0' to '/usr/src/php/ext/redis'�[0m�[91m: No such file or directory�[0m�[91m
�[0m�[31mERROR�[0m: Service 'php' failed to build: The command '/bin/sh -c curl -L -o /tmp/redis.tar.gz https://github.com/phpredis/phpredis/archive/$PHPREDIS_VERSION.tar.gz && tar xfz /tmp/redis.tar.gz && rm -r /tmp/redis.tar.gz
&& mv phpredis-$PHPREDIS_VERSION /usr/src/php/ext/redis' returned a non-zero code: 1
win10下,docker-compose up -d 之后 db未成功启动。
注释docker-compose-dev.yml部分启动成功。
# volumes:
# - ./app/database:/var/lib/mysql
可以用yum安装么
ERROR: Service 'php' failed to build: Tag 7.0-fpm not found in repository docker.io/library/php
checking for libzip... not found
configure: error: Please reinstall the libzip distribution
ERROR: `/tmp/pear/temp/zip/configure --with-php-config=/usr/local/bin/php-config' failed
ERROR: Service 'console' failed to build: The command '/bin/sh -c apt-get update && apt-get install -y git curl wget cron vim locales libfreetype6-dev mariadb-client && rm -rf /var/lib/apt/lists/* && pecl install zip && docker-php-ext-enable zip && docker-php-ext-install mysqli pdo_mysql' returned a non-zero code: 1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.