Skip to content

docker_images

Valerio Arnaboldi edited this page Mar 23, 2018 · 1 revision

Textpressocentral Docker images are meant to ease installation, testing, and deployment of the project. We provide a set of Docker images that can be pulled from our private registry at http://tpc.textpresso.org:5043/v2/. Username and password are required to access the registry.

Create a new account on the registry

To create a new user on the registry, follow these steps:

  1. login to tpc.textpresso.org
  2. cd /usr/local/docker-registry/nginx
  3. sudo htpasswd registry.passwd

After these steps, you can log in to the registry:

docker login -u <your_username> http://tpc.textpresso.org:5043/v2/

Pushing an image to the registry

To push an image to the registry after an update, run the following command:

docker push tpc.textpresso.org:5043/v2/valerio/<image_name>:<image_tag>

Running an image

To launch a Docker image and make it run in background, use the following command:

docker run --privileged -td -p8080:80 -v/mnt/data4/textpresso_test/:/data tpc.textpresso.org:5043/v2/valerio/ubuntu-tpc-deploy

The option -d tells docker to run the image in background. The option -p8080:80 maps the port 8080 of the host to the port 80 of the image. The option -v can be used to mount external volumes and make them accessible to the image. To know more about the parameters needed for testing and deployment, see information provided in the following sections.

The option --privileged grants the permission to access all devices of the host to the Docker container. This is required, for example, for mounting external directories and download data from external sources.

Connecting to a running image

To execute a shell on a running image and get a prompt line, use the following command:

docker exec -i -t <image_label_or_id> /bin/bash

Docker images hosted on the registry

Docker image for testing

This [file](tpc.textpresso.org:5445/textpresso/libtpc/Docker-tpc can be used to create a Docker image based on Ubuntu 16.04 that contains all the libraries and programs needed to install and run all Textpressocentral software. It can be used as a starting point for Textpressocentral installation and deployment or for testing the compilation and installation processes of the project. It is currently used with a Docker runner in the continuous integration pipeline of the projects.

The image does not contain the source code of the projects. To download the code on the image, clone it from after adding the ssh key of the image to the repository. To compile the code of the project, follow the instructions in the README files in the projects root directories.

Note that the image does not contain any Lucene indices or any tpcas files, and it does not contain a pre-populated db needed to run Textpressocentral. The script tpctl.sh in Textpressocentral project can be used to link existing indices and tpcas files to Textpressocentral. To read external existing files from the image, use the option -v when running the image. The database must be created and configured manually.

Generating the image

The image can be created using the Docker-testing file from the root directory of the project with the following command:

cd /project/root/dir
docker build -t tpc.textpresso.org:5043/v2/valerio/ubuntu-tpc:latest -f Dockerfile-tpc .

The default location for external files in the image is /data. The image requires the following structure for the /data directory:

/data
+-- luceneindex
+-- tpcas

Use the option -v of the docker run command to specify the /data directory structure:

docker run --privileged -td -p8080:80 -v/path/to/postgres:/data/postgres -v/path/to/luceneindices:/data/luceneindex -v/path/to/tpcas:/data/tpcas tpc.textpresso.org:5043/v2/valerio/ubuntu-tpc
Clone this wiki locally