0

I had assumed that docker-compose volumes are mounted before the container's service is started. Is this the case?

I ask, since I've got a docker-compose.yml that, amongst other things, fires up a parse-server container, and mounts a host directory in the container, which contains some code the service should run (Cloud Code).

I can see the directory is mounted correctly after docker-compose up by shelling into the container; the expected files are in the expected place. But the parse-server instance doesn't trigger the code in the mounted directory (I checked it by adding some garbage; no errors).

Is it possible the volume is being mounted after the parse-server service starts?

This is my docker-compose.yml:

version: "3"

volumes:
  myappdbdata:
  myappconfigdata:

services:
  # MongoDB
  myappdb:
    image: mongo:3.0.8
    volumes:
      - myappdbdata:/data/db
      - myappconfigdata:/data/configdb

  # Parse Server
  myapp-parse-server:
    image: parseplatform/parse-server:2.7.2
    environment:
      - PARSE_SERVER_MASTER_KEY=someString
      - PARSE_SERVER_APPLICATION_ID=myapp
      - VERBOSE=1
      - PARSE_SERVER_DATABASE_URI=mongodb://myappdb:27017/dev
      - PARSE_SERVER_URL=http://myapp-parse-server:1337/parse
      - PARSE_SERVER_CLOUD_CODE_MAIN = /parse-server/cloud/
    depends_on:
      - myappdb
    ports:
      - 5000:1337
    volumes:
      - ./cloud:/parse-server/cloud
Darren Black
  • 1,030
  • 1
  • 9
  • 28

2 Answers2

1

I'm not sure of the response as I can't find this information in the docs. But I had problems with volumes when I needed them mounted before the container was really running. Sometimes the configuration files were not loaded for example.

The only way to deal with it, is to create a Dockerfile, copy what you want, and use this image for your container.

Hth.

Fiber Optic
  • 184
  • 5
  • Gah; I was really afraid that might be the case (and I can't find any documentation on this either). Seems like a major downside. At the least it certainly makes this workflow harder. – Darren Black Feb 21 '18 at 08:04
  • This actually doesn't help here. I've copied the files into the image (and I've checked they're there in the running container). The code still doesn't get triggered. It's starting to smell like something is awry with the parse-server image. – Darren Black Feb 21 '18 at 11:26
0

Sadly enough, the biggest issue here was whitespace

PARSE_SERVER_CLOUD_CODE_MAIN = /parse-server/cloud/

should have been

PARSE_SERVER_CLOUD=/parse-server/cloud/

Used 1.5 days chasing this; fml.

Darren Black
  • 1,030
  • 1
  • 9
  • 28