Increase watchers in GitHub Workflow when running from a docker image

I’m currently running a  job in my workflow using my custom docker image which has all the environment setup. 

On the step of Expo Deploy i’m running into this error Error: ENOSPC: System limit for number of file watchers reached. I can’t increase the watchers in my docker image as it is only available in read-only mode if not ran with privileges. 

The job in my workflow

expo-publish:
    name: Expo Publish
    needs: test
    runs-on: ubuntu-latest
    container:
      image: bluebasejs/github-actions-image

    strategy:
      matrix:
        node-version: [12]

    steps:
      - uses: actions/checkout@v1
      - name: Install Dependencies
        env:
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
        run: yarn install

      - name: Build Expo
        run: HOME=/root bluebase expo:build

      - name: Expo Deploy
        uses: BlueBaseJS/expo-deploy-github-action@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          EXPO_CLI_USERNAME: ${{ secrets.EXPO_CLI_USERNAME }}
          EXPO_CLI_PASSWORD: ${{ secrets.EXPO_CLI_PASSWORD }}

Adding  this step to the job 

- run: fs.inotify.max_user_watches=524288 | tee -a /etc/sysctl.conf && sysctl -p

results in the error 

sysctl: setting key "fs.inotify.max_user_watches": Read-only file system

This is a docker limitation, you cannot change sysctl settings by default.

You may be able to change the sysctl settings using the --sysctl ... option, adding that to the container options.

1 Like

Solved it by adding the  –privileged  to the options

@ethomson wrote:

This is a docker limitation, you cannot change sysctl settings by default.

 

You may be able to change the sysctl settings using the --sysctl ... option, adding that to the container options.

1 Like