Files

Dockerfile
index.php

Content

Dockerfile:

FROM php:7.2-fpm

RUN mkdir /app

WORKDIR /app

ADD . /app

EXPOSE 9000

CMD ["php", "-S", "0.0.0.0:9000"] # 9000 是 PHP 镜像默认暴露的端口

index.php:

<?php

phinfo();

构建镜像与创建容器

docker build -t simplest-php .

docker run -it -p 9000:9000

# or 

docker run -d -p 9000:9000