Unable to install ruby in docker image

ruby
php
circle.yml
2.0
cci-20

#1

I’m building a PHP and deploying it using Capistrano. It works all fine on version 1, but upgrading to version 2 I have a few problems.

  • The docker container doesn’t have ruby installed, when I try to install it I get a permission denied error (even with sudo)
  • The machine executor doesn’t have php installed

Do I have to manually install php, ruby and everything else I need in the machine?
I would prefer to use the docker container if there is a way to install php in there.


#2

You can either:

  • create a single Docker image with all of these things installed
  • use a Ruby or PHP image and install the other

If you choose the later, what image were you starting from?


#3

I was using the circle php image “circleci/php:7.1”, and trying to install ruby but I keyt getting permission denied errors.


#4

Can you provide as much of your config as possible so we can help debug?


#5

Hey Feliciano, I’ve had a look through my git history but I can’t seem to find the commit where I tried to install ruby in the docker image. Here’s what my config looked like before I decided to use version 1:

version: 2
jobs:
  build:
    docker:
      - image: circleci/php:7.1

    steps:
      - checkout

      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "composer.json" }}
          # fallback to using the latest cache if no exact match is found
          - v1-dependencies-

      - run: php composer.phar install --no-interaction --prefer-dist --optimize-autoloader

      - save_cache:
          paths:
            - ./vendor
          key: v1-dependencies-{{ checksum "composer.json" }}
        
      - run: vendor/bin/phpunit --coverage-text=build/text/coverage.txt --log-junit=build/junit/junit.xml

      - store_test_results:
          path: build/junit

Either way, I’ve got it working in version 1 now, and I know that I’ve just got to build my own docker image that I can user for version 2, so you can probably close this ticket out.

Thanks for your help.


#6