0
votes

I am trying to get Gitlab CI runner to work with DigitalOcean to test my app using docker-compose.

I want to run docker-compose up to test my app on DigitalOcean.

So it says to create a new DigitalOcean server with Docker on Ubuntu 14.04 https://about.gitlab.com/2016/04/19/how-to-set-up-gitlab-runner-on-digitalocean/

Then I need to pick an image to use in my .gitlab-ci.yml file.

But I don't want to use an image, I want to run docker-compose -f ci.yml up to start the tests.

This means that I have to choose an image: e.g. ubuntu 14.04 then install docker and docker-compose in that image. But that has its own issues http://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-docker-for-ci/ in addition to Docker throwing me errors on running .gitlab-ci.yml:

$ docker daemon
time="2016-04-21T06:38:10.793651117Z" level=info msg="New containerd process, pid: 3765\n" 
time="2016-04-21T06:38:11.824956129Z" level=info msg="Graph migration to content-addressability took 0.00 seconds" 
time="2016-04-21T06:38:11.827302975Z" level=warning msg="Running modprobe bridge br_netfilter failed with message: modprobe: ERROR: ../libkmod/libkmod.c:556 kmod_search_moddep() could not open moddep file '/lib/modules/4.4.6-coreos/modules.dep.bin'\nmodprobe: ERROR: ../libkmod/libkmod.c:556 kmod_search_moddep() could not open moddep file '/lib/modules/4.4.6-coreos/modules.dep.bin'\n, error: exit status 1" 
time="2016-04-21T06:38:11.828852474Z" level=warning msg="Running modprobe nf_nat failed with message: `modprobe: ERROR: ../libkmod/libkmod.c:556 kmod_search_moddep() could not open moddep file '/lib/modules/4.4.6-coreos/modules.dep.bin'`, error: exit status 1" 
time="2016-04-21T06:38:11.832218690Z" level=warning msg="Running modprobe xt_conntrack failed with message: `modprobe: ERROR: ../libkmod/libkmod.c:556 kmod_search_moddep() could not open moddep file '/lib/modules/4.4.6-coreos/modules.dep.bin'`, error: exit status 1" 
time="2016-04-21T06:38:11.867564889Z" level=fatal msg="Error starting daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain: iptables failed: iptables -t nat -N DOCKER: iptables v1.4.21: can't initialize iptables table `nat': Permission denied (you must be root)\nPerhaps iptables or your kernel needs to be upgraded.\n (exit status 3)" 

ERROR: Build failed: exit code 1

Now if I spin up a new DigitalOcean server with Ubuntu 14.04 then run the same commands, it works fine (presumably because it's just Ubuntu --> Docker , rather than Ubuntu --> Docker --> Ubuntu --> Docker).

Question

How can I run docker-compose up using Digital Ocean and Gitlab CI runner without running Docker in Docker?

2
thanks for the -1 :( ... any comments though?lukeaus

2 Answers

1
votes

When you create your droplet in digital ocean, use the template ubuntu with docker already installed.

Then you should install the docker compose yourselft in the droplet.

After installing and running gitlab runner in your droplet, you can register a runner with shell as executor.

The last step is to use docker compose in your gitlab ci file. Since shell executor runs script locally(in the host where gitlab runner runs), you can use both docker and docker compose you already prepared.