Get started playing with Craft CMS 3 in a few command lines with Docker
About CraftCMS : https://github.com/craftcms
Download Docker : https://www.docker.com/community-edition#/download
- Configure env:
$ cp .env.example .env
- Start container:
$ docker-compose up -d
- Enter container:
$ docker-compose exec php bash
$ composer install
$ craft install
Service | Path |
---|---|
Website | http://localhost:8080 |
PhpMyAdmin | http://localhost:8081 |
Mail catcher | http://localhost:8082 |
Logs | log/ |
docker-compose exec php craft
or docker-compose exec php composer require guzzlehttp/guzzle
)
- Get the latest version number : https://github.com/craftcms/cms/releases
- Change
craftcms/cms
version incomposer.json
- Start and enter container (cf: Quickstart)
- Run
$ composer update
- Run
$ craft migrate/all
- Run
$ sudo nano /etc/hosts
and add127.0.0.1 myhost.local
- Modify
.env
and setSITE_URL=myhost.local
+CRAFT_PORT=80
- Run
$ docker-compose up
- If it fails make sure no service like Apache is running on port 80
The PHP and Nginx images are host on Docker Hub because first build takes a long time.
You can use volume in docker-compose.yml
to override files in images
The docker images sources are available : https://github.com/atillay/docker-images/tree/master/craftcms3
If you change mysql credentials in .env you have to re-create mysql container:
- Database will be deleted, make a dump with PhpMyAdmin
- Remove db folder :
$ rm -rf docker/db
- Run :
docker-compose up
- Re-import your database on PhpMyAdmin
Release new version on Docker Hub :
$ docker build -t atillay/craftcms3-php ./docker/php
$ docker push atillay/craftcms3-php