• 8
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

Docker Compose - Adding wrong folder

I have a project folder containing my docker compose file. This references a child folder as a sub project.

When running docker compose an ADD adds the docker-compose location and not the sub directory as expected.

project/docker-compose.yml

db:
  image: postgres
api:
  build: ./api
  command: bundle exec rails s --port 3000 --binding 0.0.0.0
  ports:
    - "3000:3000"
  links:
    - db
  volumes:
    - .:/myapp

Here is the api dockerfile.

FROM ruby:2.2.3

RUN apt-get update -qq && apt-get install -y build-essential

ENV APP_HOME /myapp
RUN mkdir $APP_HOME
WORKDIR $APP_HOME

ADD Gemfile* $APP_HOME/
RUN bundle install

ADD . $APP_HOME # Expect this to add project/api to /myapp but adds project

The fix was to map the volume correctly in the docker compose file.

db:
  image: postgres
api:
  build: ./api
  command: bundle exec rails s --port 3000 --binding 0.0.0.0
  ports:
    - "3000:3000"
  links:
    - db
  volumes:
    - ./api:/myapp
  • 0
Reply Report
      • 1
    • Interesting that you worked it out. However, I do not fully understand how that can make a difference. What happens if you leave out the volumes: declaration altogether? [Because I would think that ADD is a build-time command which means run-time volume mappnigs do not make a difference?]

Trending Tags