Skip to content

zackijack/docker-php-artisan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Docker PHP Artisan

A minimal Docker image for Laravel Artisan CLI based on official PHP image

What is Artisan?

Artisan is the command-line interface included with Laravel. It provides a number of helpful commands that can assist you while you build your application.

You can read more about Artisan in Laravel official documentation.

Usage

To view a list of all available Artisan commands, just run the zackyjack/php-artisan image without any additional command:

docker container run --rm --interactive --tty \
    --volume $PWD:/app \
    zackyjack/php-artisan

To serve application with serve command, you need to specify host to 0.0.0.0, so you can open it in your host browser:

docker container run --rm --interactive --tty \
    --publish 80:8000 \
    --volume $PWD:/app \
    zackyjack/php-artisan serve --host 0.0.0.0

And don't change default serve port, if you need to change port, just specify it in --publish flag. E.g. to change port to 8080:

docker container run --rm --interactive --tty \
    --publish 8080:8000 \
    --volume $PWD:/app \
    zackyjack/php-artisan serve --host 0.0.0.0

By default, Artisan runs as root inside the container. This can lead to permission issues on your host filesystem. You can run Artisan as your local user:

docker container run --rm --interactive --tty \
    --volume $PWD:/app \
    --user $(id -u):$(id -g) \
    zackyjack/php-artisan make:migration create_tasks_table

About

A minimal Docker image for Laravel Artisan CLI based on official PHP image

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published