To build a disposable PHP environment
[d]
┗ [docker]
┗ [php73]
┣ Dockerfile
┗ [src]
┗ index.php
Search dockerhub for the base image in advance.
Dockerfile
FROM php:7.3.22-apache-stretch
COPY src/ /var/www/html
RUN apt-get update
$ cd /d/docker/php73
$ docker build --tag=hellophp .
$ docker image ls
$ docker run -p 5000:80 --name myphp -d hellophp
Docker-Toolbox is not localhost. You need to know the IP address of your Docker machine.
$ docker-machine ls
It can be accessed by the combination of the confirmed IP address and the port number on the host side when the container is started.
http://{IP address}:5000
Check the ID of the container and stop it.
$ docker ps
$ docker stop {CONTAINER ID}
You can also delete containers that you no longer use.
$ docker ps -a
$ docker rm {CONTAINER ID}
Recommended Posts