Docker/Gitlab CI – Environment Set Up Guide

1. Install Docker Engine

Use Ubuntu as example, follow the official installation guide before the “Optional Configurations” section:

https://docs.docker.com/engine/installation/linux/ubuntulinux/

In “Optional Configurations” section, only need to do “Create a docker group” and “Configure a DNS server for use by Docker”.

Create a docker group:

Why: Need to do this so that we can run docker without sudo.

Test that it works:

$docker ps

Configure a DNS server for use by Docker:

Why: Need to do this so that docker engine can resolve hostnames.

Test that it works:

$docker run -it ubuntu /bin/bash

$ping archive.ubuntu.com

An example error screenshot of not having this configured:

1
2. Install Docker Compose

Follow official guide: https://docs.docker.com/compose/install/
3. Install GitLab CI Runner and register multiple runners to use with Docker

Follow this guide: https://littletechblogger.wordpress.com/2016/03/28/install-and-set-up-gitlab-ci-runner-to-use-docker/
4. Set up job to clean non-tagged images and stopped containers

Use meltwater/docker-cleanup:  https://hub.docker.com/r/meltwater/docker-cleanup/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s