How to install Koken using docker compose?

Koken is a content management system (CMS) and web site publishing for photographers.


Built for photography

Your images are your most important asset. Koken treats them with the attention they deserve by including a full-featured management interface that looks and feels like a desktop application.[1]

Work and words, together

Write about portfolio updates, inspiration, or anything that comes to mind. Images, videos, slideshows and content from Flickr, Instagram, Vimeo, SoundCloud and Twitter are a snap to display.[1:1]

Content management system (CMS)

Koken Admin UI

Website templates

Koken themes



Before you begin, you must have Docker and Docker Compose installed. We will be working on CentOS 7.

Docker container

We are going to use this image koken/koken-lemp.

# docker-compose.yml
version: "2"
    image: koken/koken-lemp:latest
      - 8080:8080
      - ./www:/usr/share/nginx/www
      - ./mysql:/var/lib/mysql

Note that it exposes port 80 and 8080, you can use either port.

Run the container

docker-compose up -d

Open up your browser and visit http://localhost:8080 to start installation.


API error

You might encounter API error like the following.

The theme is not able to contact Koken's API. Ensure that your host is not blocking loopback connections.

To fix the error, add the following line in www/storage/configuration/user_setup.php file.

define('LOOPBACK_HOST_HEADER', true);

File permission error

You might get file permission error if you moved mysql and www folder or changed their permissions. This will result in database connection error (MySQL) and reading file error (nginx).

Fix the permission error by running the following commands.

sudo chown -R 103:106 mysql
sudo chown -R 33:33 www

Reverse proxy nginx SSL (optional)

server {
    listen 80;

    # The following is for Letsencrypt
    location ^~ /.well-known/acme-challenge/ {
        default_type "text/plain";
        root   /etc/nginx/acme-challenge/;

    location / {
      return 301 https://$server_name$request_uri;

server {
    listen               443;

    ssl                  on;
    ssl_certificate      /etc/nginx/letsencrypt/live/;
    ssl_certificate_key  /etc/nginx/letsencrypt/live/;

    ssl_session_timeout  5m;

    ssl_protocols        SSLv2 SSLv3 TLSv1;
    ssl_ciphers          ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
    ssl_prefer_server_ciphers   on;

    server_tokens        off;
    charset              utf-8;

    location / {
        proxy_set_header X-Real-IP           $remote_addr;
        proxy_set_header X-Forwarded-For     $proxy_add_x_forwarded_for;
        proxy_set_header Host                $host;
        proxy_set_header X-Forwarded-Host    $host;
        proxy_set_header X-Forwarded-Server  $host;
        proxy_set_header X-Forwarded-Proto   $scheme;
        proxy_pass       http://koken:80;

We can configure it to run with SSL protocol. If you do, then there are two things that you need to modify; otherwise, you will encounter errors.

API Error

The following will fix API error. Modify www/app/site/Koken.php file; replace self::$protocol with http.

/* Original */
curl_setopt($curl, CURLOPT_URL, self::$protocol .'://' . $host . self::$location['real_root_folder'] . '/api.php?' . $url);

/* After */
curl_setopt($curl, CURLOPT_URL, 'http://' . $host . self::$location['real_root_folder'] . '/api.php?' . $url);

Image loading error (404)

The following will fix image loading issue (not loading). Modify www/app/koken/Utils/KokenAPIphp file. Add $this->protocol = 'http'; in the end of __construct function.

function __construct()
  $this->protocol = 'http';

Alternative solution

You can fix the above errors by setting X-Forwarded-Proto header to http in your external reverse proxy configuration. If you go with this solution, you will get a popup error when you upload images on CMS; But that is fine. It will upload the images successfully but with a error popup. Refresh the page and you will see your uploaded images in your library content.

server {
    listen 443;
    location / {
        proxy_set_header X-Forwarded-Proto http;
        proxy_pass http://koken:8080;


  1. Koken ↩︎ ↩︎

Mike Mai
Mike Mai   Brooklyn, New York
I am full-stack web developer, passionate about building world class web applications. Knowledge in designing, coding, testing, and debugging. I love to solve problems.