A base PHP 5.6 CLI image1 for demonstrating legacy projects available at EWC Docker Hub.
An older version of PHP that some older codebases would require such an environment to run in.
Other Packages Included:
- Composer v1.7.1
- libxml2-dev
- libzip-dev
- yaml
- yaml-dev
- zip
- unzip
- git
- gettext
- gettext-dev
- mariadb-dev
- vim
- pcre-dev ${PHPIZE_DEPS}2
- autoconf
PHP Extensions:
- gettext
- mysqli
- pdo_mysql
- zip
- yaml
Note that the php-5-6-cli is the Docker Compose Service to Build.
There is a build script included that uses the local .env file & an Evil Wizard Creations Protocol that makes this much simpler.
build-up-php-5-6-cli.shAlternatively there is the full Procedure.
-
Build the Image using the
docker-compose-build.yamlconfiguration.docker-compose -f ./docker-compose-build.yaml build --no-cache php-5-6-cli
-
Compose Up using the
docker-compose-build.yamlconfiguration will use the new built Image and-dto detach.docker-compose -f ./docker-compose-build.yaml up -d
Build the Docker Image without using cached versions of previous image build stages.
sudo docker build \
-f php-5-6-cli.Dockerfile \
--target build-php-5-6-cli \
--build-arg APP_ENV=local \
--no-cache \
-t php-5.6-cli:latest \
.N.B.
-
Using
-f php-5-6-cli.DockerfileTo specify the filename to build otherwise it is expected to be named
Dockerfile. -
Using
--target build-php-5-6-cliTo select the build target stage3 from the Dockerfile.
-
Using
--build-arg ARG=valueTo set build argument values to use.
This creates a named container and attaches it to the host network and may cause port conflict if the host machine is already listening on any exposed ports from the Docker Image being used.
sudo docker run \
-d \
--network host \
-v "$(pwd)"/public_html:/var/www/html \
--name php-5-6-cli \
php-5-6-cli:latestOR
This creates a named container and attaches it to the bridge network and allows for port forward mapping from the host to the Container.
sudo docker run \
-d \
--network bridge \
-p 8080:80/tcp \
-v "$(pwd)"/public_html:/var/www/html \
--name php-5-6-cli \
php-5-6-cli:latestN.B.
-
Using
-v "$(pwd)"/public_html:/var/www/htmlTo Volume Mount the folder
public_htmlfrom the current folder to/var/www/htmlon the running container. -
Using
-p 8080:80/tcpTo map port 8080 on the Host machine to port 80 on the Container using the bridge network.
-
Using
--name php-5-6-cliTo name the Container being created.
sudo docker start php-5-6-clisudo docker stop php-5-6-clisudo docker exec -it php-5-6-cli /bin/shThis PHP 5.6 CLI build environment should NOT be used anywhere near a production environment. This build is for showcasing legacy systems that simple would not run in modern environments & as such it is littered with security holes and exploitation's.