Running job inside privileged docker on 'machine' executor

Hello!

I need to run my job inside a privileged Docker container. According to CircleCI2.0 docs, this is possible when using a ‘machine’ executor.

Is there any way to configure config.yml such that my jobs will be executed on the docker container (which runs on the VM machine?)

i.e, something like this (this is a plain example but will help demonstrate what I’m trying to do):

version: 2.1

jobs:
  say-hello:
    machine:
      image: ubuntu-2004-cuda-11.2:202103-01
    runs-on:
      docker:
          image: docker.io/account/example:latest # All steps will run inside this container
          privileged: True

    steps:
      - checkout
      - run:
          command: "echo hi there" # This will run inside the docker container

Not that I’m aware of no. You’d need to spin the container up and then run commands inside of it just as you would on a local machine. So some combination of docker run, docker exec, Bash scripts, Docker entrypoints, etc.

2 Likes