Run command on host when using docker




I’m using docker executor with CircleCI 2.0.
I need to run a command on the host machine, but don’t find a way to do it.

The command I want to run on the host machine is as follows

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

My content of my CircleCI config.yml is as follows:

# Ruby CircleCI 2.0 configuration file
# Check for more details
version: 2
      # specify the version you desire here
      - image: circleci/ruby:2.4.1-node-browsers
          RAILS_ENV: test
      # Specify service dependencies here if necessary
      # CircleCI maintains a library of pre-built images
      # documented at
      # - image: circleci/postgres:9.4
      - image: circleci/mysql:5.7

    working_directory: ~/repo

      - checkout

      # Download and cache dependencies
      - restore_cache:
          - v1-dependencies-{{ checksum "Gemfile.lock" }}
          # fallback to using the latest cache if no exact match is found
          - v1-dependencies-

      - run:
          name: install dependencies
          command: |
            bundle install --jobs=4 --retry=3 --path vendor/bundle

      - save_cache:
            - ./venv
          key: v1-dependencies-{{ checksum "Gemfile.lock" }}

      # Database setup
      - run: bin/rails db:migrate:reset

      # run tests!
      - run:
          name: run tests
          command: |
            mkdir /tmp/test-results
            bin/rspec --format RspecJunitFormatter \
                      --out /tmp/test-results/rspec.xml

      # collect reports
      - store_test_results:
          path: /tmp/test-results
      - store_artifacts:
          path: /tmp/test-results
          destination: test-results

So, my question is, how can I run a command on the host when using docker executor.
Thank you.


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.