Skip to content

estebanzeus/sample_php72_amzn2_docker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About This Repository

A docker image of Amazon Linux 2 with PHP 7.2 installed.

Usage

You need to install docker first.

CLI

# Clone this repository
$ git clone https://github.com/lucheholdings/sample_php72_amzn2_docker && cd sample_php72_amzn2_docker

# Build a docker image.
$ docker build . -t php72-amzn2-sample

# Launch a container
$ docker run --rm -it -v `pwd`/shared:/shared  php72-amzn2-sample bash

# Run a php script
bash-4.2# php hello.php

Web Application (With PHP Built-in Web Server)

Please build the docker image as well as the CLI case.

# Launch a container, exposing port 80 to the host (mapping it to port 10080 on the host).
$ docker run -v `pwd`/shared:/shared -p 127.0.0.1:10080:80/tcp --rm -it php72-amzn2-sample bash

# Start PHP built-in web server on the container.
bash-4.2# php -S 0.0.0.0:80

# (From the host) sending a HTTP request to the server on the container.
$ curl http://localhost:10080/hello.php

Note

We have tested it with docker for mac.

About

An Amazon Linux 2 docker image with PHP 7.2 installed.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dockerfile 93.7%
  • PHP 6.3%