How to install CKAN on CentOS 7 using Docker images

Prime knots chartCKAN is a powerful data management system that makes data accessible – by providing tools to streamline publishing, sharing, finding and using data. CKAN is aimed at data publishers (national and regional governments, companies and organizations) wanting to make their data open and available.

I’m going to show you how to install CKAN on a CentOS 7 box using Docker images.
Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications. By “Dockerizing” the app platform and its dependencies, you can abstract away differences in OS distributions and underlying infrastructure.

Let’s start from a fresh CentOS 7 installation (minimal ISO will do fine).
Enable EPEL repository:

rpm -Uvh http://www.nic.funet.fi/pub/mirrors/fedora.redhat.com/pub/epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm

Fetch and install docker
yum install docker

start it:
service docker start

make it start at boot:
chkconfig docker on

Now it’s time to tell Docker to download 3 images we need to run CKAN: ckan core, PostgreSQL and Apache Solr.

Use the following line to make all in a blow:
echo postgresql solr ckan | xargs -n 1|while read img; do docker pull ckan/$img; done

You should see something like this happening:


Pulling repository ckan/postgresql
192057470cf4: Download complete 
511136ea3c5a: Download complete 
f10ebce2c0e1: Download complete 
82cdea7ab5b5: Download complete 
5dbd9cb5a02f: Download complete 
74fe38d11401: Download complete 
134f4d40b939: Download complete 
3dbfeba8c696: Download complete 
e41d33b3f0da: Download complete 
68a2ed609ba6: Download complete 
dce4973d6c30: Download complete 
482fa40d477b: Download complete 
88d6d4f3524e: Download complete 
f7204d73c5fd: Download complete 
8c5fea728b57: Download complete 
a82e97726aee: Download complete 
a6d3537c42eb: Download complete 
9fcff2bd6ddf: Download complete 
5fe38a9167e5: Download complete 
Pulling repository ckan/solr
3a9ee0bc7fe7: Download complete 
511136ea3c5a: Download complete 
e465fff03bce: Download complete 
23f361102fae: Download complete 
9db365ecbcbb: Download complete 
ad892dd21d60: Download complete 
42478e57e0ae: Download complete 
67fdd4f3d901: Download complete 
4d2c19a894da: Download complete 
e5415a3b938f: Download complete 
3e8328fb6f0b: Download complete 
b443c20b05e7: Download complete 
bbe6b7d67406: Download complete 
3c4a0bde0b28: Download complete 
a10f3320c209: Download complete 
75a04edc83b3: Download complete 
eeeca43778a2: Download complete 
3cac90fec2f7: Download complete 
676cb000a6d0: Download complete 
7a9f6ae6c642: Download complete 
Pulling repository ckan/ckan
7c63bc15a452: Download complete 
511136ea3c5a: Download complete 
5e66087f3ffe: Download complete 
4d26dd3ebc1c: Download complete 
d4010efcfd86: Download complete 
99ec81b80c55: Download complete 
82c9a6741336: Download complete 
5cbfee875b7b: Download complete 
afc7fc2f17c1: Download complete 
5a21d2ea788e: Download complete 
521a42e63a27: Download complete 
35c2d5a269ff: Download complete 
47a405cc3694: Download complete 
09cda2bc9ae1: Download complete 
5886f16f2f00: Download complete 
5d9930ab7dc7: Download complete 
e80977a2620c: Download complete 
87f83c8cd714: Download complete 
2314cdd94075: Download complete 
0b76de9c97c2: Download complete 
c2bae08b47df: Download complete 
51b85a2f46ae: Download complete 
0c84d1ff650f: Download complete 
c1694a4b5d03: Download complete 
e67155cf6795: Download complete 
54da19f21853: Download complete 
4deab99859a9: Download complete 
b4bdf66dd86e: Download complete 
6eeb7779eaa0: Download complete 
c7f70cc77490: Download complete 
98b10ef8efbb: Download complete 
5e4178c7f78f: Download complete 
264e12392d11: Download complete 
1c91448c6bb5: Download complete 
4882c6a19eea: Download complete 
1d13d9e69ecb: Download complete 
f0efc827e05e: Download complete 
25e3d1a1e521: Download complete 
acd96508885b: Download complete 
1489a325e22c: Download complete 

Look at the images downloaded:


docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
ckan/ckan           latest              7c63bc15a452        7 weeks ago         771.2 MB
ckan/postgresql     latest              192057470cf4        8 weeks ago         429 MB
ckan/solr           latest              3a9ee0bc7fe7        10 weeks ago        758.4 MB

Time to start each image in a separate container (specifying a name for each container):
docker run -d --name db ckan/postgresql && docker run -d --name solr ckan/solr && docker run -d -p 80:80 --link db:db --link solr:solr ckan/ckan

Check that everything is running:


docker ps
CONTAINER ID        IMAGE                    COMMAND               CREATED              STATUS              PORTS                NAMES
46af1ba28dd5        ckan/ckan:latest         /sbin/my_init         About a minute ago   Up About a minute   0.0.0.0:80->80/tcp   goofy_sammet0             
f4b93a4e8b6c        ckan/solr:latest         java -jar start.jar   About a minute ago   Up About a minute   8983/tcp             goofy_sammet0/solr,solr   
5c5721b2a18f        ckan/postgresql:latest   /usr/local/bin/run    2 minutes ago        Up 2 minutes        5432/tcp             db,goofy_sammet0/db

Some useful Docker commands:

Open a bash shell in a running container:
docker run -i -t ckan/ckan /bin/bash

Stop all running containers:
docker stop $(docker ps -a -q)

Start containers and run images (without specifying name for each container):


docker start db solr
docker run -d ckan/postgresql
docker run -d ckan/solr
docker run -d -p 80:80 --link db:db --link solr:solr ckan/ckan

Add an administrator account to your CKAN:

docker run -i -t --link db:db --link solr:solr \
    ckan/ckan \
    /sbin/my_init -- \
    /bin/bash -c \
    '$CKAN_HOME/bin/paster --plugin=ckan sysadmin -c $CKAN_CONFIG/ckan.ini add administrator'

then press y and type a password.

Insert test data in CKAN:
docker run -i -t --link db:db --link solr:solr     ckan/ckan     /sbin/my_init --     /bin/bash -c     '$CKAN_HOME/bin/paster --plugin=ckan create-test-data -c $CKAN_CONFIG/ckan.ini'

Find your PostgreSQL IP address:


docker inspect --format {{.NetworkSettings.IPAddress}} db
172.17.0.51

If you want to connect to your PostgreSQL DB instance remember that default postgresql user/pass are: ckan/ckan
docker run -i -t ckan/postgresql /bin/bash -c 'psql -h 172.17.0.51 -U ckan'
enter password ckan at prompt

!!Don’t do it now!!
If you want to remove all containers (when they are already stopped):
docker rm $(docker ps -a -q)

!!Don’t do it now!!
To remove all images:
docker rmi $(docker images -q)

At last, connect to your CKAN instance via a web browser, login as administrator, start adding contents and making customizations.

This is just a quick guide to make you started configuring CKAN and not intended to use in a production environment. You are warmly encouraged to read all the background documents and the manuals as well.

Creative Commons License
How to install CKAN on CentOS 7 using Docker images by Antonio Prado is licensed under a Creative Commons Attribution-ShareAlike 4.0 International

Leave a Reply