By default, docker-compose expect a `docker-compose.yaml` or `docker-compose.yml` file. If missing, this lead to the following error :
```
$ docker-compose build
ERROR:
Can't find a suitable configuration file in this directory or any
parent. Are you in the right directory?
Supported filenames: docker-compose.yml, docker-compose.yaml
```
1.5 KiB
Build Docker image for Monica
If you want to build your own docker image for Monica, follow these steps:
Use docker-compose to build and run your own image
Use this process if you want to modify Monica source code and build your image to run.
Edit .env to set DB_HOST=mysql (as mysql is the creative name of the MySQL container).
Then run:
docker-compose -f docker-compose.dev.yml build
docker-compose -f docker-compose.dev.yml up
Use Docker directly to run with your own database
Use this process if you're a developer and want complete control over your Monica container.
If you aren't using docker-compose, edit .env again to set the DB_* variables to match your database. Then run:
scripts/docker/build.sh
You can add the tag name as a parameter:
scripts/docker/build.sh monica-dev
Run monica with:
docker run --env-file .env -p 80:80 monica-dev
Or run a command in the container:
docker run --env-file .env -it monica-dev bash
There's a bunch of docker-compose examples here.
Note that uploaded files, like avatars, will disappear when you
restart the container. Map a volume to
/var/www/monica/storage/app/public if you want that data to persist
between runs. See docker-compose.yml for examples.
Other documents to read
Connecting to MySQL inside of a Docker container Use mobile app with standalone server