Running TestLink within Docker

TestLink was developed with PHP 5, and while the comments in the install instructions indicate that they are aware of the need to upgrade, it doesn’t sound like a priority for them.

Ideally we would want to move away from maintaining a server that allows us to run such an old version of PHP. Docker could be a good candidate for this.

The following details a sample configuration that works for me on my laptop, and might therefore be useful as a base for us in the future. This is just a stream of consciousness at this point.

For the purposes of my testing, I also ran the database as a Docker instance. For production this is probably undesirable.

Private network

In a real environment this won’t be needed - we want to have the database on a different server than the TestLink application. But for purist sake, I created a private network within Docker:

docker network create --label=testlink-net testlink-net

Database instance

I had a lot of trouble with various versions of MySQL. Eventually I went with an official image of MariaDB, and created a container via:

docker run \
  -d \
  -e "MYSQL_ROOT_PASSWORD=password" \
  --net=testlink-net \
  --net-alias db \
  --name testlinkDb \

Note the highly sensitive password in there (smile), plus the network alias.

Various version of the TestLink images had different problems. The version I went with eventually is imtnd/testlink. The Dockerfile is very straightforward, so I am confident about running it locally.

docker run \
  -d \
  --name testlink \
  -p 2080:80 \
  --net-alias testlink \
  --network testlink-net \

Note that TestLink is quite happy using the network alias of db configured for the database as the hostname for the database. No need for IP addresses.

Notes on the Dockerfile

This is based on the Ubuntu image - we could certainly lock this down tighter.

This installs the application into the /testlink/ context, we would probably want to remove the context.

The TestLink directories are not exposed to the host - we would probably want to change that so we can do simple backups.