Assuming you already have an installed an running Gitlab server, you need to install and configure a GitLab runner:
Install gitlab-runner: https://docs.gitlab.com/runner/install/linux-repository.html
Run the gitlab-runner shell setup, described here: https://docs.gitlab.com/ce/ci/docker/using_docker_build.html
Get the registration token from the Settings / CI/CD Settings page.
You can now use docker commands in the script section of your .gitlab-ci.yml file defining your pipeline.