Building krita with Docker

The Dockerfile is based on the official KDE build environment that is used on KDE CI for building official AppImage packages. This guide is valid for Ubuntu and Ubuntu-based Linux distributions.


First make sure you have Docker installed

sudo apt install docker

Decide where you want to store your Docker images. All the docker images and containers are by default stored in a special docker-daemon controlled folder under /var directory. You might not have enough space there for building Krita (it needs about 10 GiB). In such a case it is recommended to move the docker images folder into another location, where there is enough space.

# this step is optional
echo 'DOCKER_OPTS="-g /path/where/you/want/to/store/docker/images/"' >> /etc/default/docker

Then you need to download deps and Krita source tree. These steps are not included into the Dockerfile to save internal bandwidth

# create directory structure for container control directory
git clone git:// krita-auto-1

cd krita-auto-1
mkdir persistent

# copy/checkout Krita sources to 'persistent/krita'
cp -r /path/to/sources/krita ./persistent/krita

## or ...
# git clone kde:krita persistent/krita

# download the deps archive

Build the docker image and run the container

./bin/build_image krita-deps
./bin/run_container krita-deps krita-auto-1

Enter the container and build Krita

# enter the docker container (the name will be
# fetched automatically from '.container_name' file)


… now you are inside the container with all the deps prepared …

# build Krita as usual
cd appimage-workspace/krita-build/ ~/persistent/krita
make -j8 install

# start Krita

Extra developer tools

To install QtCreator, enter the container and start the installer, downloaded while fetching dependencies. Make sure you install it into ‘~/qtcreator’ directory without any version suffixes, then you will be able to use the script below:

# inside the container

To start QtCreator:

# from the host

Stopping the container and cleaning up

When not in use you can stop the container. All your filesystem state is saved, but all the currently running processes are killed (just ensure you logout from all the terminals before stopping).

# stop the container

# start the container

If you don’t need your container/image anymore, you can delete them from the docker

# remove the container
sudo docker rm krita-auto-1

# remove the image
sudo docker rmi krita-deps


Krita binary is not found after the first build

Either relogin to the container or just execute source ~/

OpenGL doesn’t work on NVidia GPU with proprietary drivers

The docker run script automatically forwards the GPU devices into the container, but it doesn’t install the drivers for the GPU. You should install exactly the same version of the driver that is installed on your host system. Just run the following script when you are on host: