diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000000000000000000000000000000000000..bc71a10e49184d7c318246b032777d07855f9b70
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,7 @@
+build
+dist
+*.egg-info
+.eggs
+.pytest_cache
+./tests/fixtures/*
+./tests/__pycache__
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 84fb63b3c6f54a11ea6f6e97f74b7207660b4edb..235f68264580db8fcbda9376ba4c4632a4d678bf 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,13 +1,15 @@
 test-py2:
   stage: test
+  tags: ["docker", "shell"]
   script:
-    - ./tests/run_ci.sh 2
+    - ./tests/run_tests.sh 2
 
 
 test-py3:
   stage: test
+  tags: ["docker", "shell"]
   script:
-    - ./tests/run_ci.sh 3
+    - ./tests/run_tests.sh 3
 
 sdist:
   stage: deploy
diff --git a/tests/Dockerfile b/tests/Dockerfile
new file mode 100644
index 0000000000000000000000000000000000000000..4b6b1d7de2dfcde659c7cb67ab030a4cca084041
--- /dev/null
+++ b/tests/Dockerfile
@@ -0,0 +1,29 @@
+FROM debian:bullseye-slim
+
+ARG pytag="3"
+
+# Install basic system/python requirements
+RUN apt-get -qq update && apt-get -qq install \
+        gcc \
+        git \
+        python${pytag}-dev \
+        python${pytag}-minimal \
+        python${pytag}-pip \
+        python${pytag}-setuptools && \
+    apt-get clean -y && \
+    rm -rf /var/lib/apt/lists/*
+
+# Install basic system/python requirements
+RUN apt-get -qq update && apt-get -qq install \
+        postgresql-client && \
+    apt-get clean -y && \
+    rm -rf /var/lib/apt/lists/*
+
+ENV PIP_TRUSTED_HOST "iweb1.sips"
+ENV PIP_NO_CACHE_DIR "false"
+ENV LC_ALL C.UTF-8
+ENV LANG C.UTF-8
+
+WORKDIR /code
+COPY . .
+RUN pip${pytag} install -i https://iweb1.sips/eggs --trusted-host=iweb1.sips -e ".[testing]"
diff --git a/tests/run_ci.sh b/tests/run_ci.sh
deleted file mode 100755
index a9a4dada59d140eb31f4d9232ebf6c29f3ba13df..0000000000000000000000000000000000000000
--- a/tests/run_ci.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env bash
-ver=${1:-3}
-docker run --rm -v $PWD:/code -w /code python:${ver} /code/tests/run.sh
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
new file mode 100755
index 0000000000000000000000000000000000000000..119b81318314e1cd9eea791b7bdb007070e5c5db
--- /dev/null
+++ b/tests/run_tests.sh
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+set -e
+ver=$1
+[[ ! "$ver" =~ (2|3) ]] && echo "Must provided 2 or 3 as python version" && exit 1
+
+tag=$ver
+if [[ $ver == 2 ]]; then
+    tag=""
+fi
+
+image=edosl0util${ver}
+
+docker build -t ${image} -f tests/Dockerfile --build-arg=pytag=${tag} .
+docker run \
+    -e PYTHONDONTWRITEBYTECODE=1 \
+    -e HOME=/code \
+    -v $PWD:/code \
+    -u $(id -u):$(id -g) \
+    -w /code \
+    ${image} \
+    py.test -xv