royfuwei / docker-ubuntu16-apache-php5.6

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dockerfile make ubuntu16.04 apache php5.6

Dockerfile製作參考1and1internet 的ubuntu-16-apache-php-5.6 並借用files/設定

主要流程

安裝docker、docker-compose、php版本、composer等 mac安裝docker會自動安裝,如果沒有安裝install docker composer 本機端都裝好後,整包clone下來:

git clone <file>
cd <file>

# 如果要改port,到docker-compose.yml
docker-compose up -d

# 如果需要從dockerfile開始製作image,到docker-compose.yml,image改成build
docker-compose build
docker-compose up -d

cd www
composer install

docker 以下分三種使用

  1. 直接下載image使用
# 設定環境變數
UID=999
PORT=80
WEB_ROOT="/var/www/" # 只能使用絕對路徑

# 執行docker run
docker run -u ${UID}:0 -p ${PORT}:80 -v ${WEB_ROOT}:/var/www/ royfuwei/ubuntu16-apache-php5.6
  1. 直接使用docker-compose執行,直接使用image
cd 檔案位置
# 執行
docker-compose up -d
  1. 使用dockerfile設定,更改docker-compose.yml檔案,再執行docker-compose 如果php有需要做什麼設定,可以到files/Dockerfile裡面做設定,然後更改一下docker-compose.yml: docker-compose.yml更改:

docker 執行:

docker-compose build
docker-compose up -d

開發檔案位置

如果直接下載image使用,開發的檔案位置會在設定的絕對路徑。 如果是用docker-compose執行,開發的檔案位置會在www/,一旦docker-compose設定好了,可以在檔案夾底下開發,但不要整個移動www/檔案位置 如果移動後無法出現網頁,重新執行container:

docker ps -a
docker restart <container id>

目前www/資料夾底下放slim jwt測試的網頁 http://127.0.0.1-首頁 http://127.0.0.1/auth/token-post 直接取得token http://127.0.0.1/auth/secure-get header 帶Authorization token就可以訪問 http://127.0.0.1/auth/not-secure-get 不用header 帶Authorization token就可以訪問

ds


Dockerfile製作參考1and1internet 的ubuntu-16-apache-php-5.6

使用supervisor運行管理的ubuntu16.04 基於ubuntu:xenial,先自製加上supervisor運行管理的ubuntu,產生的自製ubuntu16 image。 後續基於自製ubuntu16 image,在dockerfile中安裝上apache的服務,編成新的ubuntu16-apache image,開啟的port是80,443,如果有需要針對apache做一些設定,可以在ubuntu16-apache的dockerfile以及files資料夾設定。 ubuntu16-apache image上,可以在dockerfile中安裝不同版本的php製成新的ubuntu16-apache-phpX.X iamge。

1&1 Internet SE 有許多的image可以提供參考

About


Languages

Language:PHP 70.0%Language:Dockerfile 21.4%Language:HTML 8.7%