Creating ubuntu based docker image for runner

Hi,

I’ve created my docker image with following Dockerfile:

FROM ubuntu:xenial
MAINTAINER Mariusz Pasek <pasiasty@gmail.com>

RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections

RUN apt-get update
RUN apt-get install -y apt-utils
RUN apt-get install -y libboost-all-dev
RUN apt-get install -y libgtest-dev
RUN apt-get install -y cmake
RUN apt-get install -y git
RUN apt-get install -y vim
RUN apt-get install -y nano
RUN apt-get install -y libyaml-cpp-dev

RUN git clone https://github.com/pasiasty/docker_scripts.git ~/docker_scripts
RUN ~/docker_scripts/build/initialize.sh

RUN mkdir /workdir

ENTRYPOINT ["sleep", "infinity"]

and I was trying to use this image (it’s public image on docker called mpasek/default_environment) as my docker Runner. Unfortunately I keep getting following error:

Running with gitlab-runner 10.4.0 (857480b6)
  on docker-runner (35a7c4f1)
Using Docker executor with image mpasek/default_environment ...
Using docker image sha256:2dd35ba0f2007fcaed5186b3f5d8f926b85ca2dc46ad3c15c23fffc754d05e43 for predefined container...
Pulling docker image mpasek/default_environment ...
Using docker image mpasek/default_environment ID=sha256:6710ac11a033efd830e6b64248df7c7681a9cee801bb41b9ab2eb4887e2ff138 for build container...
Running on runner-35a7c4f1-project-6-concurrent-0 via level-server...
Fetching changes...
HEAD is now at d38b5bd whitespaces
Checking out d38b5bd7 as master...
Skipping Git submodules setup
sleep: invalid option -- 'c'
Try 'sleep --help' for more information.
sleep: invalid option -- 'c'
Try 'sleep --help' for more information.
ERROR: Job failed: exit code 1

does anyone have idea what am I doing wrong? When I’m using clean alpine image everything works fine.

Could you describe what you are trying to do with your ENTRYPOINT ["sleep", "infinity"] ?

As far as I am seeing sleep has no option for -c

 sleep - delay for a specified amount of time
╰─>$ sleep --help
Usage: sleep NUMBER[SUFFIX]...
  or:  sleep OPTION
Pause for NUMBER seconds.  SUFFIX may be 's' for seconds (the default),
'm' for minutes, 'h' for hours or 'd' for days.  Unlike most implementations
that require NUMBER be an integer, here NUMBER may be an arbitrary floating
point number.  Given two or more arguments, pause for the amount of time
specified by the sum of their values.

      --help     display this help and exit
      --version  output version information and exit

GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
Full documentation at: <http://www.gnu.org/software/coreutils/sleep>
or available locally via: info '(coreutils) sleep invocation'

Also I am not getting where you are supplying the option -c to sleep…

I’ve been using this container before to build project locally. I wanted the container to stay alive forever after running docker run. I didn’t think that it could cause a problem with gitlab, but I’ll remove it and check how it’ll work. Thanks for reply anyway.

I thought that gitlab was somehow calling this sleep anyway

After removing works now :slight_smile: anyway it seems weird to me that gitlab would interact anyhow with docker container ENTRYPOINT. But thanks for help!

1 Like

Well I spotted the problem there.
Glad it worked, anyways.
Just a suggestion.
Instead of writing so many RUN, you could just install all the packages in a single line.

RUN apt-get install -y apt-utils libboost-all-dev libgtest-dev cmake git vim nano libyaml-cpp-dev

As far as I can tell, you’re not providing -c anywhere, so how remove it? What did you remove that made things work? The whole thing (ENTRYPOINT ["sleep", "infinity"])?

I ask because I’m getting a similar error, but with make: make: invalid option -- 'c'. And similarly, I am not the one calling make -c. In fact, this happens in a job where I don’t call make at all :astonished: