Docker

Production docker

There is an docker repo for Kimai 2 that includes the Docker file from this repo and a docker file suitable for running in a production environment.

Any issues with the container rather than the application itself should be raised here.

Development docker

The Dockerfile supplied with Kimai 2 is suitable mainly for development. It runs a self contained version of Kimai 2 using a SQLite database in the docker container. Be careful, the recorded data can easily be lost when running updates or other tasks.

Build the docker

docker build -t kimai/kimai2:dev .

Run the docker

docker run -ti -p 8001:8001 --name kimai2 --rm kimai/kimai2:dev

You can then access the site on http://127.0.0.1:8001. If that doesn’t work check the IP of your docker:

docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' kimai2

You can find Kimai at that IP on port 8001.

Mac using docker-machine

When using dock-machine on your Mac, you need to use the IP of your machine. Considering you started the machine named default, you find the IP with:

docker-machine ip default

Running commands in the docker

You can run any command in the container in this fashion once it is started. Add -ti to attach a terminal.

docker exec -ti kimai2 bash

Create a user and dummy data

See the docs here for full instructions, but this creates a user admin/admin with all privileges.

docker exec kimai2 bin/console kimai:create-user admin admin@example.com ROLE_SUPER_ADMIN admin

To install the fixtures:

docker exec kimai2 bin/console kimai:reset-dev

Developing against the docker

It is possible to mount your source tree and sqlite DB into the container at run time.
N.B. The sqlite database needs to writable by the www-data user. Use chown 33:33 kimai.sqlite on the host machine.

docker run --rm -d -p 8001:8001 \
    -v $(pwd)/src:/opt/kimai/src \
    -v $(pwd)/var/data/kimai.sqlite:/opt/kimai/var/data/kimai.sqlite \
    --name kimai2 kimai/kimai2:dev

Now edits in your local files will be served by the container and all database changes will persist.

The official docker documentation has more options on running the container.

Further docker solutions

As there are several approaches to docker images, you have multiple docker images to choose from. They were built by the community, we do not support them - for question please ask in their repositories: