Mount project folder using docker-compose and circle ci


#1

Hi team,

I am trying to build my testing project in circle ci using docker -compose . I am able to build it successfully , but when I am trying to mount the project folder not able to do it.

Please find the error below

Circle ci config file

version: 2
jobs:
  build:
    docker:
      # using custom image, see .circleci/images/primary/Dockerfile
      - image: circleci/php:7.1.16

       
    working_directory: '~/project'
    


    steps:
      - checkout
      - run: 'pwd'
      - run: 'ls'

      
      - setup_remote_docker:
           docker_layer_caching: true

      # This should go into custom primary image, here's only for the sake of explanation
      - run:
          name: Install Docker client
          command: |
            set -x
            VER="17.03.0-ce"
            curl -L -o /tmp/docker-$VER.tgz https://get.docker.com/builds/Linux/x86_64/docker-$VER.tgz
            tar -xz -C /tmp -f /tmp/docker-$VER.tgz
            sudo mv /tmp/docker/* /usr/bin
      - run:
          name: Install Docker Compose
          command: |
            set -x
            curl -L https://github.com/docker/compose/releases/download/1.19.0/docker-compose-`uname -s`-`uname -m` > ~/docker-compose
            #sudo curl -L https://github.com/docker/compose/releases/download/1.11.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
            #sudo chmod +x /usr/local/bin/docker-compose   
            
      - run:
          name: Start container and verify it's working
          command: |
            set -
            ls -latr
            ls -ltr
            docker-compose build testing-suite
            docker-compose up       

Docker file

FROM platform/environments:php7.1-centos7

RUN yum clean all

RUN yum install -y openssl-dev epel-release php-pear php-devel php-libsodium gd gd-devel php-gd

RUN pecl install mongodb

# install libsodium, mongodb gd
RUN echo "extension=mongodb.so" >> /etc/php.ini
RUN echo 'date.timezone="America/Detroit"' >> /etc/php.ini

#WORKDIR "/testing-suite"
WORKDIR "/project"

Docker-compose file

    version: '3'

    services:
        testing-suite:
            build:
              context: ./Docker

           
           # working_dir: /testing-suite
           
            command: "./bin/run beta chrome checkAllLinks update"
            volumes:
                #- "${HOST_PATH_SRC_TEST_SUITE}:/testing-suite"
                - .:/project
            depends_on:
                - selenium-chrome


        selenium-chrome:
            image: selenium/standalone-chrome:3.5.3
            volumes:
                - /dev/shm:/dev/shm
            ports:
                - "4444:4444"

#2

Are you sure ./bin/run exists? Maybe you could change this to a fully-qualified path, in order to make it more resilient?


#3

I already tried by changing to full path . the problem is circle ci could not mount my project folder to the docker container created .


#4

Ah, right. I wonder if you’re bumping into this problem? It comes up quite regularly here.


#5

If you’re using Docker volumes, which it looks like so in the Docker Compose file, then you’d want to use the machine executor not the docker executor`.


#6

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