Kimai2: docker image for kimai2

Created on 28 Aug 2018  路  20Comments  路  Source: kevinpapst/kimai2

FYI, created a Docker container for kimai2 which is available at https://hub.docker.com/r/dysonsphere/kimai2/

Used php7.2-apache as base image everything is working as expected. Nice job on the tool!

I would like to keep the docker container updated with the latest releases, that can be done by manually updating the code using git inside the container and republishing it but an automated way would be even better.

Is there any automated build pipeline this project is using where I can hook my docker container so that it gets updated automatically with every release?

If there is no such build pipeline in place yet, are the core devs interested to have one?

PS: We love this tool during the evaluation phase and have decided to bundle it into one of our services packages.

installation

Most helpful comment

I couldn't get the one from @dysonspherelab running. But created one myself yesterday based on the php:7.2-apache Image.
It's not fully functioning right now but hopefully I have some time this evening to get everything working.
If you want I could create a PR so that we could work on a "official".

All 20 comments

Hi @dysonspherelab !

Nice, thanks! Could you submit a PR with the Dockerfile (and probably a short documentation chapter about how to use it) as well, so people can use it out-of-the-box?

Regarding the build pipeline, there is none yet. There is so much other stuff, which I wanted to tackle before that part. I could probably add a web hook to a service if that would help?

Could you share who is "we" and what is that "service package" you talk about?

Hey @kevinpapst we are Dysonspherelab :) it is a cloud technology focused company and we are offering a managed devops service which bundles few software packages in which we have decided to use kimai2 for the open source time tracking solution.

I have provided very simple documentation in my docker hub read me. It goes like this:

Run the app container
docker run -d -p 80:80 --name kimai2 dysonsphere/kimai2

Now install all dependencies for Kimai 2:

sudo -u www-data composer install --no-dev --optimize-autoloader
Optionally create the database:

bin/console doctrine:database:create
Create all schema tables:

bin/console doctrine:schema:create
Make sure that upcoming updates can be correctly applied by setting the initial database version:

bin/console doctrine:migrations:version --add --all
Warm up the cache (as webserver user):

sudo -u www-data bin/console cache:warmup --env=prod
Create your first user with the following command. You will be asked to enter a password afterwards:

bin/console kimai:create-user username [email protected] ROLE_SUPER_ADMIN
Tip: You can skip the "create user" step, if you are going to import data from Kimai v1.

For available roles, please refer to the user documentation (https://github.com/kevinpapst/kimai2/blob/master/var/docs/users.md).

Most of it is just a simple copy paste fromyour read me :)

I would open a new PR for dockerizing the future builds, thanks

Since I'm interested to run this thing on my Synology I wonder how the progress on the Docker-Image is?

I am not using docker and haven't tested it. But did you give it a try?
Sounds as if the one from @dysonspherelab works ... even though in the future I would really prefer to use an official docker/debian base image and a simple Dockerfile.

I couldn't get the one from @dysonspherelab running. But created one myself yesterday based on the php:7.2-apache Image.
It's not fully functioning right now but hopefully I have some time this evening to get everything working.
If you want I could create a PR so that we could work on a "official".

Yes please, that would be awesome @Haidy777 !
Kimai is fairly easy to setup and if we use SQLite we can provide a fully functional Dockerfile.
Even though I'd prefer nginx and phpfpm over Apache.

I couldn't get the one from @dysonspherelab running. But created one myself yesterday based on the php:7.2-apache Image.

@Haidy777 the docker image is working. Please tell more about the error you were facing while running the container?
I have not linked it with any external services like database using sqlite that uses docker file system only to store the data. But that is ephermal storage. It is part of our Devops package offering, which is a service we are going to launch soon.

Added few screenshots for reference
screen shot 2018-09-20 at 6 24 06 pm
screen shot 2018-09-20 at 6 24 50 pm
screen shot 2018-09-20 at 6 25 10 pm

  1. container ran on port 80 using docker command: docker run -d -p 80:80 --name kimai2 dysonsphere/kimai2
  2. New super admin user created entering into the container and running the command: bin/console kimai:create-user username [email protected] ROLE_SUPER_ADMIN
  3. Kimai2 is accessible at port 80 on localhost

@Haidy777 It would be really helpful if you could send us the logs from your Docker container.

docker logs [container_name]

Oh! beg my pardon there was a confusion
I did used an external mysql db for the app, anyways here is my docker-compose.yaml file.
@kevinpapst you can include the docker-compose.yaml into the repository if you want to :)
screen shot 2018-09-20 at 6 46 23 pm

@dysonspherelab Thanks for your response, but I'm currently looking for a SQLITE-Version. Do you have the Source of your Dockerfile somewhere, I couldn't find it on Github / Dockerhub?

@Haidy777 Let me walk you through the process I used to build this docker image. Also, your login will work once you will connect it to a mysql service, that was the confusion I mentioned earlier.

  1. I cloned the source
  2. created a base ubuntu16.04 docker container, lets call it app container
  3. created a base mysql 5.7 image
  4. sshd inside the app container
  5. installed php-7.2 and apache inside the app container
  6. Downloaded composer
  7. installed all dependencies, sudo -u www-data composer install --no-dev --optimize-autoloader
  8. created database, bin/console doctrine:database:create, inside connected mysql service
  9. created all the required schema, bin/console doctrine:schema:create
  10. ran the migraitons, bin/console doctrine:migrations:version --add --all
  11. warmed up the cache, sudo -u www-data bin/console cache:warmup --env=prod
  12. created super admin user, bin/console kimai:create-user username [email protected] ROLE_SUPER_ADMIN
  13. created new container out of running app, docker container commit
  14. pushed the new docker container to my dockerhub account

If you follow above steps exactly as it is you can get a docker container similar to mine.

So, if you want to use my container docker pull and run it, also run a mysql container, and start creating new users to access those.

Let me know if you need more info regarding this, thanks

@dysonspherelab did you copy all source files into the container? or does the person who wants to run the container have to execute docker run -d -p 80:80 --name kimai2 dysonsphere/kimai2 in the Kimai directory?

all the source code is already present inside the container, the docker command has to be executed in users shell.

Okay, then this is a different use-case scenario. Users could update it, but that requires a decent amount of Docker knowledge.
What I had in mind was more of a "developer" solution, probably even production ready - but with a mounted source directory.

Here's my take on it (with Nginx and FPM): https://github.com/felixhummel/kimai-in-docker/tree/kimai2

Let me know if you'd like to integrate this here.

As Kimai does ship a Dockerfile now, I closed this issue.
But as we all know, Docker can be used in many ways and there is not "the one solution" that fits all.
So I added links to your solutions @dysonspherelab and @felixhummel here:
https://github.com/kevinpapst/kimai2/blob/master/var/docs/docker.md#further-docker-solutions
Thanks for your contributions!

Sounds awesome :)

nice! :)

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. If you use Kimai on a daily basis, please consider donating to support further development of Kimai.

Was this page helpful?
0 / 5 - 0 ratings