Skip to main content

Docker

Install Applications​

You need to install Docker Desktop.

Set up Local environment​

There are Dockerfile template of local environment on GitHub.

Initial setting up​

Open Terminal, and run following commands.

# Creating Developing Directory
mkdir ~/Virtual

# Anywhere is OK, move to your favorite place
# For example, into your user directory
cd ~/

# Getting datas from GitHub
git clone https://github.com/sushat4692/docker-lamp.git

# Move to downloaded directory
cd docker-lamp

# Duplicate `.env.sample` to `.env`
cp .env.sample .env

Operating Docker commands​

# Up (Build and Start) containers
./command.sh up

# Start containers
./command.sh start

# Stop containers
./command.sh stop

# Delete containers, images and volumes
./command.sh delete

How to change PHP versions​

This docker setting is able to change PHP version by the following command:

./command.sh up {version number}

so, for example if you want to run PHP 8.1:

./command.sh up 81

After that​

After you setting up, you can use local environment and it's related localhost to ~/Virtual.

http://foo.localhost/ -> ~/Virtual/foo/htdocs
http://bar.localhost/ -> ~/Virtual/bar/htdocs