Disposable PHP with Docker

environment

Purpose

To build a disposable PHP environment

procedure

Directory structure

[d]
┗ [docker]
  ┗ [php73]
    ┣ Dockerfile
    ┗ [src]
      ┗ index.php

Create Dockerfile

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

Build an image from a Dockerfile

$ cd /d/docker/php73
$ docker build --tag=hellophp .

View a list of images to see if there is a build

$ docker image ls

Launch the container from the image

$ docker run -p 5000:80 --name myphp -d hellophp

Check the IP address of your Docker machine

Docker-Toolbox is not localhost. You need to know the IP address of your Docker machine.

$ docker-machine ls

Operation check

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

Clean up

Check the ID of the container and stop it.

$ docker ps
$ docker stop {CONTAINER ID}

Other

You can also delete containers that you no longer use.

$ docker ps -a
$ docker rm {CONTAINER ID}

Recommended Posts

Disposable PHP with Docker
Php settings with Docker
[PDO → DB connection with docker, PHP]
Lightweight PHP 7.4 development environment created with Docker
Launch MariaDB with Docker
Rails deploy with Docker
Run Pico with docker
Explode Docker with WSL2
Use Puphpeteer with Docker
Operate Emby with Docker
Try WildFly with Docker
Use ngrok with Docker
Run Payara with Docker
[Docker] Connection with MySQL
Install Composer with Docker
Debug the VSCode + Docker + PHP development environment with XDebug.
Pytorch execution environment with Docker
Use GDAL with Python with Docker
Deploy with EC2 / Docker / Laravel
Run TAO Core with Docker
Docker management with VS Code
Set up GitLab with docker
[Vscode xdebug3.0 x PHP x Docker]
Run Rails whenever with docker
Get started with DynamoDB with docker
[Docker] Rails 5.2 environment construction with docker
Spring Boot starting with Docker
Build docker environment with WSL
Version control CocoaPods with Docker
Web application built with docker (1)
I tried BIND with Docker
React environment construction with Docker
Build DynamoDB local with Docker
[Docker] Use whenever with Docker + Rails
Using PlantUml with Honkit [Docker]
I tried to make an introduction to PHP + MySQL with Docker
Rails + MySQL environment construction with Docker
Create a Vue3 environment with Docker!
Node.js environment construction with Docker Compose
Run lambda with custom docker image
Deploy a Docker application with Greengrass
Build Couchbase local environment with Docker
Install java with Ubuntu 16.04 based Docker
Build a Node.js environment with Docker
Environment construction with Docker for beginners
Why use orchestration tools with Docker
Build PlantUML environment with VSCode + Docker
Try running cloudera manager with docker
Molecular phylogenetics exercise with docker (working)
IP address interfered with Docker bridge
Build environment with vue.js + rails + docker
Read dump file with Docker MySQL
Hello World with Docker and C
General error: 1812 occurs with docker + laravel
Build Rails environment with Docker Compose
Create SolrCloud verification environment with Docker
WordPress with Docker Compose on CentOS 8
Prepare a transcendentally simple PHP & Apache environment on Mac with Docker
[Google Cloud] Getting Started with Docker
[SRE / Docker] Start control with Dockerize
Operate a honeypot (Dionaea) with Docker