docker學習7:Docker 安裝 PHP
學習連結:
直接透過方法二學習
方法二、docker pull php
查詢Docker Hub上的php映象
[root@huixuan nginx]# docker pull webdevops/php-nginx
Using default tag: latest
Trying to pull repository docker.io/webdevops/php-nginx ...
latest: Pulling from docker.io/webdevops/php-nginx
1be7f2b886e8: Pull complete
6fbc4a21b806: Pull complete
c71a6f8e1378: Pull complete
4be3072e5a37: Pull complete
06c6d2f59700: Pull complete
5c1c30789448: Pull complete
42eeae6547fc: Pull complete
3ff6b06497b0: Pull complete
60c69a4834cc: Pull complete
cbb835cfffc0: Pull complete
604f67c351eb: Pull complete
072984b59472: Pull complete
943570e2b1d3: Pull complete
1e35c99925af: Pull complete
fbb001c74aae: Pull complete
Digest: sha256:38b9e5a8072f83ae2e7ad47554f58c8ca4c4308adb3909070ad75deb761bb898
Status: Downloaded newer image for docker.io/webdevops/php-nginx:latest
[root@huixuan nginx]#
使用webdevops/php-nginx映象
執行容器
[root@huixuan nginx]# docker run -p 9000:9000 --name myphp -d webdevops/php-nginx
458820a216542e70d7deaac772713a5149f82be6d35c1e6aafdb5edd6e1ca97e
[root@huixuan nginx]#
命令說明:
-p 9000:9000 :將容器的9000埠對映到主機的9000埠
--name myphp-fpm :將容器命名為myphp-fpm
-v ~/nginx/www:/www :將主機中專案的目錄www掛載到容器的/www
-v $PWD/conf:/usr/local/etc/php :將主機中當前目錄下的conf目錄掛載到容器的/usr/local/etc/php
-v $PWD/logs:/phplogs :將主機中當前目錄下的logs目錄掛載到容器的/phplogs
檢視容器啟動情況
[root@huixuan nginx]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
458820a21654 webdevops/php-nginx "/entrypoint super..." 46 seconds ago Up 44 seconds 80/tcp, 443/tcp, 0.0.0.0:9000->9000/tcp myphp
[root@huixuan nginx]#
透過瀏覽器訪問phpinfo()
PS:此處是透過nginx+php實現web服務,nginx配置檔案的fastcgi_pass應該配置為webdevops/php-nginx容器的IP。
fastcgi_pass 172.17.0.4:9000;
容器IP的查方法
docker inspect 容器ID或容器名 |grep '"IPAddress"'
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/312079/viewspace-2153599/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- docker 學習之一:docker 安裝Docker
- docker學習1:CentOS Docker 安裝DockerCentOS
- docker學習6:Docker 安裝 NginxDockerNginx
- Docker學習(二)- Docker 安裝 JenkinsDockerJenkins
- docker 安裝 PHPDockerPHP
- Docker學習(1)安裝Docker
- docker 安裝與學習Docker
- Centos 7 Docker 安裝CentOSDocker
- Centos 7 安裝 Docker 與 Docker ComposeCentOSDocker
- Docker 入門學習筆記一:Ubuntu安裝 DockerDocker筆記Ubuntu
- 使用Docker安裝Redis - 學習三DockerRedis
- Docker安裝(學習筆記一)Docker筆記
- 【docker】docker 安裝配置 nginx+php+composerDockerNginxPHP
- CentOS7 安裝 dockerCentOSDocker
- centos7安裝dockerCentOSDocker
- Docker安裝ES7Docker
- CentOS7 docker docker-Composer 安裝CentOSDocker
- Centos7安裝安裝部署dockerCentOSDocker
- centos7 docker 安裝教程CentOSDocker
- centos7快速安裝dockerCentOSDocker
- centOs7安裝最新dockerCentOSDocker
- Centos7上安裝dockerCentOSDocker
- centos7下docker安裝CentOSDocker
- centos7下安裝 dockerCentOSDocker
- Centos7安裝Docker EngineCentOSDocker
- Centos7下安裝DockerCentOSDocker
- Centos7 yum安裝 DockerCentOSDocker
- docker mlocati/docker-php-extension-installer安裝composerDockerPHP
- CentOS學習筆記 – 6. docker安裝CentOS筆記Docker
- Docker架構及在Centos7上安裝dockerDocker架構CentOS
- docker PHP 安裝 Redis 擴充套件DockerPHPRedis套件
- 【Docker】2. Docker的架構介紹、安裝與解除安裝 (CentOS 7)Docker架構CentOS
- CentOS 7 Docker安裝部署Go WebCentOSDockerGoWeb
- CentOS7 docker安裝部署教程CentOSDocker
- Docker-CE 安裝(centos7)DockerCentOS
- 在Centos7上安裝DockerCentOSDocker
- Cent OS 7安裝和使用dockerDocker
- docker:安裝centos7映象(六)DockerCentOS