Skip to content

cleaniquecoders/training-2023-12-docker-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Docker Hello World with PHP

This is a typical Hello World for PHP in Docker.

Table of Content

Usage

git clone https://github.com/cleaniquecoders/docker-php-hello-world

Build the Image

Then navigate to directory and build the image:

cd docker-php-hello-world/
docker docker build -t hello-world .

t argument used for tagging the image. . is the current directory build the image.

Run the Container

Typically we can run in two approach:

Running the Container in Foreground

Now run the container:

docker run -it -p 80:80 hello-world

p argument used for map exposed port in Docker container to the Host machine. it argument used for output of the container is forwarded to our terminal.

Navigate to your browser now at localhost.

Running the Container in Background

You may want to run Docker in background:

docker run -d -p 80:80 hello-world

Listing All the Running Containers

docker ps

Will output the following:

CONTAINER ID   IMAGE                                                 COMMAND                  CREATED          STATUS                PORTS                                                            NAMES
1a77e445027b   hello-world                                           "docker-php-entrypoi…"   56 seconds ago   Up 55 seconds         0.0.0.0:80->80/tcp                                               angry_taussig

Stopping the containers

docker stop <container-id/name>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published