I am trying to setup a build server that is running Ubuntu Linux 18.04 as a docker host.
host has three docker containers running - Docker Registry - Gitlab Server - Gitlab Runner (to build Angular Apps)
I want Gitlab Runner container to build docker image with nginx and compiled Angular code and push it to Docker Registry.
I have manage to setup all three containers running and Gitlab runner is building angular project but challenge I am facing is building docker image in Gitlab Runner container.
Docker command is not available within Gitlab Runner container to build docker image.
Is this possible ??
I have tried to install docker.io within Gitlab Runner container so after time of build, it can have docker command available but still not luck. It still says docker not available.
Here is my .gitlab-ci.yml file
stages:
- build
build:
stage: build
image: node:10.9.0
script:
- npm install -g @angular/cli
- npm install -g typescript
- npm install
- ng build --prod
- docker image build -t tag/to/image .
- docker push tag/to/image
tags:
- angular
cache:
paths:
- node_modules/
artifacts:
expire_in: 1 week
paths:
- dist/*
only:
- master
here is my nginx.conf file
worker_processes 1;
events {
worker_connections 1024;
}
http {
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html index.htm;
include /etc/nginx/mime.types;
gzip on;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
location / {
try_files $uri $uri/ /index.html;
}
}
}
here is the Dockerfile I want to use to make a build
FROM nginx:alpine
COPY nginx.conf /etc/nginx/nginx.conf
WORKDIR /usr/share/nginx/html
COPY dist/ .

image: node:10.9.0in your build step. That image does not containdockerexecutable, so you cannot execute docker commands in it.