0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Windows10でDocker PHP7.2の開発環境を構築

Last updated at Posted at 2019-05-01

##環境

  • Windows10
  • Hyper-V

##PHP7.02 + Apacheを起動する
イメージからコンテナを立ち上げる。(ローカルにimageがない場合はDocker Hubから取得してくれる。)

docker container run -d --name php-sample -v :/var/www/html -p 80:80 php:7.2-apache

##コンテナが作られているか確認

docker container ls

NAMESにphp-sampleが作られている事が確認できる。
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                NAMES
501589adf392        php:7.2-apache      "docker-php-entrypoi…"   9 minutes ago       Up 9 minutes        0.0.0.0:80->80/tcp   php-sample

##コンテナにログインします。

docker container exec -it php-sample bash

##PHPファイルを作成

echo '<?php phpinfo();'> index.php

##ブラウザで確認
http://localhost/

以下の画面が表示される。
php画面.PNG

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?