diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d1c52cbaddd85900968e47b943dae207fa85d892..eb75a46ddbed5e61fc58c36f48488b754f1a78ab 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -20,90 +20,72 @@
 #
 # ** end header
 #
+
+variables:
+   CI_REGISTRY_IMAGE: $CI_REGISTRY/caosdb-pylib-testenv
+   # When using dind service we need to instruct docker, to talk with the
+   # daemon started inside of the service. The daemon is available with
+   # a network connection instead of the default /var/run/docker.sock socket.
+   #
+   # The 'docker' hostname is the alias of the service container as described at
+   # https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#accessing-the-services
+   #
+   # Note that if you're using the Kubernetes executor, the variable should be set to
+   # tcp://localhost:2375/ because of how the Kubernetes executor connects services
+   # to the job container
+   # DOCKER_HOST: tcp://localhost:2375/
+   #
+   # For non-Kubernetes executors, we use tcp://docker:2375/
+   DOCKER_HOST: tcp://docker:2375/
+   # When using dind, it's wise to use the overlayfs driver for
+   # improved performance.
+   DOCKER_DRIVER: overlay2
+services:
+   - docker:dind
+
+image: $CI_REGISTRY_IMAGE:latest
+
 stages:
-    - setup
     - code_style
-    - build
+    - setup
     - test
+    - deploy
     
-#########
-# Setup
-#########
-
-# install formatters
-setup:install_formatters:python2.7:
-    tags: [ py27 ]
-    stage: setup
-    script:
-        - pip2 install --upgrade pycodestyle --user
-
-setup:install_formatters:python3.4:
-    tags: [ py34 ]
-    stage: setup
-    script:
-        - pip3.4 install --upgrade pycodestyle --user
-
-############
-# code_style
-############
-
-code_style:pycodestyle:python2.7:
-    tags: [ py27 ]
-    stage: code_style
-    script:
-        - ~/.local/bin/pycodestyle --count ./
-
-code_style:pycodestyle:python3.4:
-    tags: [ py34 ]
+code_style:
     stage: code_style
     script:
-        - ~/.local/bin/pycodestyle --count ./
-
-#########
-# Build
-#########
-
-# install python client (python 2.7)
-build:pycaosdb:python2.7:
-    tags: [ py27 ]
-    stage: build
-    script:
-        - python2.7 setup.py install --user
+        - pycodestyle --count ./
+        - pylint3 --unsafe-load-any-extension=y -d all -e E,F src/caosdb/common
+    allow_failure: true
 
-# install python client (python 3.4)
-build:pycaosdb:python3.4:
-    tags: [ py34 ]
-    stage: build
-    script:
-        - python3.4 setup.py install --user
-
-########
-# Test
-########
 
-# unit tests for pycaosdb
-test:pycaosdb:py34:
-    tags: [ py34 ]
+# pylint tests for pycaosdb
+test:
     stage: test
     script:
         - touch ~/.pycaosdb.ini
-        - tox -r -e py34
+        - tox -r 
 
-test:pycaosdb:py27:
-    tags: [ py27 ]
-    stage: test
-    script:
-        - touch ~/.pycaosdb.ini
-        - tox -r -e py27
-
-# pylint tests for pycaosdb (python 3.4)
-.test:pycaosdb:python3.4:pylint:
-    stage: test
-    script:
-        - /usr/bin/env python3.4 /home/caosdb/.local/bin/pylint --unsafe-load-any-extension=y -d all -e E,F client/PyCaosDB/caosdb/common/models.py
+trigger_build:
+  stage: deploy
+  script:
+    - echo $TOKEN     
+    - /usr/bin/curl -X POST
+       -F token=$TOKEN
+       -F "variables[PYLIB]=$CI_COMMIT_REF_NAME"
+       -F ref=master https://gitlab.indiscale.com/api/v4/projects/14/trigger/pipeline
 
-# pylint tests for pycaosdb (python 2.7)
-.test:pycaosdb:python2.7:pylint:
-    stage: test
-    script:
-        - /usr/bin/env python2.7 /home/caosdb/.local/bin/pylint --unsafe-load-any-extension=y -d all -e E,F client/PyCaosDB/caosdb/common/models.py
+build-testenv:
+    image: docker:latest
+    stage: setup
+    script: 
+        - cd unittests/docker
+        - docker login -u testuser -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
+          # use here general latest or specific branch latest...
+        - docker pull $CI_REGISTRY_IMAGE:latest || true
+        - docker build 
+          --pull
+          --build-arg COMMIT=$CI_COMMIT_SHORT_SHA
+          --cache-from $CI_REGISTRY_IMAGE:latest 
+          -t $CI_REGISTRY_IMAGE:latest .
+        - docker push $CI_REGISTRY_IMAGE:latest
diff --git a/tox.ini b/tox.ini
index 74d8c643c735b0ad287e36aa1841bf8a6f5d328c..dcd29575bd46a46327944c06d986202883a327dc 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
 [tox]
-envlist= py27, py34, py35, py36
+envlist= py27, py34, py35, py36, py37
 skip_missing_interpreters = true
 [testenv]
 deps=nose
diff --git a/unittests/docker/Dockerfile b/unittests/docker/Dockerfile
new file mode 100644
index 0000000000000000000000000000000000000000..295d5e0e66c93ad26e99ef2444fb3b713f42d5dd
--- /dev/null
+++ b/unittests/docker/Dockerfile
@@ -0,0 +1,7 @@
+FROM debian:latest
+RUN apt-get update && \
+	apt-get install pylint3 python3-pip tox git \
+	curl pycodestyle  -y
+ARG COMMIT="dev"
+RUN git clone -b dev https://gitlab.gwdg.de/bmp-caosdb/caosdb-pylib.git && \
+    cd caosdb-pylib && git checkout $COMMIT && pip3 install .