'Sudo in circleci

Hello I am new to circleci I really need to do a sudo inside of my job but it is asking a password (that I have obviously) Is there a way to bypass it ? I tried to play with the permission but my circleci job is generating a report and I can't move it to the right place and delete the old one without a sudo. My workspace is in the /home/circleci/workspace so I could normaly do it without a sudo but my container that docker is creating in my job is

drwx------ circleci circleci 

and not

drwxrwxrwxr root circleci.

config.yml

version: 2.1
workflows:
  testing:
    jobs:
      - runner:
          context: DockerHub
jobs:
  runner:
    machine: true
    resource_class: hello/test-qa-runner
    steps:
      - checkout
      - run:
          name: Docker login
          command: docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASS
      - run:
          name: Start all services declared in docker-compose.yml
          command: docker-compose --env-file ./env/samsung_s8_hum_beta.env up --abort-on-container-exit
      - run:
          name: Move reports to create artifact
          command: |
            cd ~/workspace
            find -name "report*[[:digit:]].html" -exec cp -rf '{}' ~/REPORTS/ \;
            find -name "report*.xml.html" -exec cp -rf '{}' ~/REPORTS/xml/ \;
      - store_artifacts:
          path: ~/REPORTS
      - run:
          name: Archive report
          command: |
            mv -f ~/REPORTS/*.html ~/ARCHIVE_REPORTS/
            mv -f ~/REPORTS/xml/*.xml.html ~/ARCHIVE_REPORTS/xml/

docker-compose.yml

version: "3.7"
services:
  launch_test:
    links:
      - appium_server
    depends_on:
      appium_server:
        condition: service_healthy
    user: root
    volumes :
      - ./reports/:/qa-test-automation/reports
      - ./apk_ipa/:/appium-server/apk_ipa
    environment:
      - DEVICE_NAME=${DEVICE_NAME}
      - DEVICE_IP=${DEVICE_IP}
      - DEVICE_UDID=${DEVICE_UDID}
      - SUITE=${SUITE}
      - APP_PATH=${APP_PATH}
      - PATH_HOST=${PWD}
    image: image1:latest
    working_dir: /qa-test-automation
    command: [ "/qa-test-automation/run_test.sh" ]
  appium_server:
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:4723/wd/hub/status"]
      interval: 10s
      timeout: 30s
      retries: 5
    volumes:
      - type: bind
        source: /var/run/usbmuxd
        target: /var/run/usbmuxd
      - /var/lib/lockdown:/var/lib/lockdown
      - ./logs/:/logs/
      - ./apk_ipa/:/appium-server/apk_ipa
      - ~/.android/:/root/.android/
    environment:
      - APP_PATH=${APP_PATH}
      - DEVICE_NAME=${DEVICE_NAME}
      - ADB_PORT=${ADB_PORT}
      - DEVICE_IP=${DEVICE_IP}
      - DEVICE_UDID=${DEVICE_UDID}
    image: image2:1.0.0
    ports:
      - ${ADB_PORT:-5037}:${ADB_PORT:-5037}
    working_dir: /appium-server
    command: [ "/appium-server/start_server.sh" ]


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source