Command Not Found Error in CircleCI

Troubleshooting Guide for "Command not found" Error

Example of error for CircleCI builds when using two docker images:

/bin/bash: {name_of_command}: command not found

Below is example `config.yml` file that uses `circleci/python:3.6.4` as primary image and `circleci/postgres:9.6.2` as an additional image that will run in a separate container with the DB service being available via port 27017 (or whatever port you want to use) in the primary container.

version: 2.1
orbs:
  slack: circleci/slack@4.0.0

jobs:
  build:
    working_directory: ~/circleci-demo-python-django
    docker:
      - image: circleci/python:3.6.4
        environment:
          PIPENV_VENV_IN_PROJECT: true
          DATABASE_URL: postgresql://root@localhost/circle_test?sslmode=disable
      - image: circleci/postgres:9.6.2
        environment:
          POSTGRES_USER: root
          POSTGRES_DB: circle_test  
    steps:
      - checkout
      - run: postgres -V

 

 

All of your commands will run in the first container that is listed (primary container). This is typically not the database container, which means that the postgres cli is likely not installed in the primary container. The same can happen for mysql and mongo.

In these cases, you can install the client using sudo pip install or the relevant package manager for the distro your image is running.

example:

- run: sudo pip install postgressql

More details can be found on Discuss here: https://discuss.circleci.com/t/bin-bash-mongo-command-not-found/16218/6

Was this article helpful?
0 out of 17 found this helpful

Comments

0 comments

Article is closed for comments.