1

I'm running a CI pipeline in gitlab-runner which is running on a linux machine. In the pipeline I'm trying to build an image.

The Error I'm getting is,

ci runtime error: rootfs_linux.go:53: mounting "/sys/fs/cgroup" to rootfs "/var/lib/docker/overlay/d6b9ba61e6eed4bcd9c23722ad6f6a9fb05b6c536dbab31f47b835c25c0a343b/merged" caused "no subsystem for mount"

The Dockerfile contains :

    # Set the base image to node:12-alpine
    FROM node:16.7.0-buster
    
    # Specify where our app will live in the container
    WORKDIR /app
    
    # Copy the React App to the container
    COPY . /app/
    
    # Prepare the container for building React
    RUN npm install
    RUN npm install react-scripts@4.0.3 -g
    # We want the production version
    RUN npm run build
    
    # Prepare nginx
    FROM nginx:stable
    COPY --from=0 /app/build /usr/share/nginx/html
    RUN rm /etc/nginx/conf.d/default.conf
    COPY nginx/nginx.conf /etc/nginx/conf.d
    
    # Fire up nginx
    EXPOSE 80
    CMD ["nginx", "-g", "daemon off;"]

The gitlab-ci.yml contains :

image: gitlab/dind
services:
  - docker:dind

variables:
  DOCKER_DRIVER: overlay


stages:
  - build
  - docker-build

cache:
  paths:
    - node_modules

yarn-build:
  stage: build
  image: node:latest
  script: 
    - unset CI
    - yarn install
    - yarn build
  artifacts:
      expire_in: 1 hour # the artifacts expire from the artifacts folder after 1 hour 
      paths:
        - build

docker-build:
  stage: docker-build
  script:
    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD
    - docker build -t $CI_REGISTRY_USER/$app_name .
    - docker push $CI_REGISTRY_USER/$app_name

I'm not getting how to resolve this, I tried upgrading docker in my linux machine.

  • What happens if youn`RUN mkdir /app` before setting the `WORKDIR`? – Charalamm Sep 23 '22 at 06:20
  • directory called app will be created. even if we call mkdir before workdir, this won't make much difference. since, when we do `COPY . /app` this will create a directory called app and then copy the contents to the app. – Shashi Prakash Sep 23 '22 at 08:18
  • when I run `mkdir /app` before setting the `WORKDIR` . The SAME error is occuring just after the running `mkdir`. previously error is just after delcaring `WORKDIR`. – Shashi Prakash Sep 23 '22 at 09:05

0 Answers0