Run pytests inside the docker container

I’m trying to create a config that will let me, build my docker image on circleci and run pytests there. However, the command for running tests requires running docker container. In config file are the things I’ve tried.

Build process is stuck on building forever after docker-compose -f docker-compose.yml -f docker-compose.ci.yml -f docker-compose.testing.yml up command, all the services seem to be running / listening but the build never ends.
I just started using circleCi, I’d greatly appreciate any help, goal is to build my image, run it, run the tests and report whether all passed or not.

version: 2.1
#working_directory: /app docker: - image: docker:17.05.0-ce-git steps: - checkout - setup_remote_docker - run: name: Install dependencies
jobs:
  build:
    docker:
      - image: cimg/base:stable
    steps:
      - setup_remote_docker:
          version: 20.10.7
      - checkout
      - run:
          name: "Build and Run"
          command: |
            docker-compose build
            docker-compose -f docker-compose.yml -f docker-compose.ci.yml -f docker-compose.testing.yml up
            docker-compose exec api pytest tests/
#  test:
#    docker:
#        - image: cimg/python:3.9.1
#    steps:
#      - checkout
#      - run:
#          name: "Test"
#          command: docker-compose exec api pytest tests/
#      - store_artifacts:
#          path: test-results.xml
#          prefix: tests

workflows:
  version: 2
  build_and_test:
    jobs:
      - build
#      - test:
#          requires:
#            - build
#          filters:
#            branches:
#              only: circleci-project-setup

general:
  branches:
    only:
     - circleci-project-setup```

Hello,

Thanks so much for reaching out and posting on Discuss!

Are you able to rerun the build with SSH and see if you run into the same issue running these commands? Does the build time out after 10 minutes or is it a specific error you receive?

Also, would you also be able to share the build link where you see this issue? I look forward to hearing back from you!