Running Integrationtest with MariaDB as Service: Errno -2] Name does not resolve

Hello everyone,

I’m building a integration test pipeline where I use MariaDB. After reading the GitLab CI/CD documentation I found the


  • mariadb:latest

definition for the GitLab CI to include the mariadb image and connect to the database. Regarding the documentation the host is mysql (Link)

But when I try to connect to the database I get the errror [Errno -2] Name does not resolve)

Part of the gitlab-ci.yml looks like this:

image: python:alpine
  name: integration
  - mariadb:latest
  MYSQL_DATABASE: test_database
  MYSQL_ROOT_PASSWORD: root_password
  DATABASE_URI_DEV: mysql+pymysql://test_user:password@mysql:3306/test_database
  MYSQL_USER: test_user
  MYSQL_PASSWORD: password

DATABASE_URI_DEV is the connection string that I use to establish the connection via SQLAlchemy.

It also doesn’t work without the port at the end. I tried it with localhost but then I get a connection refused error.

I really appreciate your help :slight_smile:

Edit: Provided more of my gitlab-ci.yml