3

Here is the docker-compose file I tried for ColdFusion 2018,

version: '3.3'
services:
cf18:
  environment:
    - acceptEULA=YES
    - password=admin
  volumes:
    - /opt/coldfusion/:/opt/coldfusion/
  ports:
    - 8500:8500
  image: adobecoldfusion/coldfusion2018:latest
  command: 'whoami'

It works but the volumes could not be mounted and I have a docker error log like below,

/opt/startup/start-coldfusion.sh: 523: cd: can't cd to /opt/coldfusion/cfusion/bin/

I need to mount this because the changes need to persist when I do Docker "docker-compose down" and "docker-compose up".

Any help would be greatly appreciated.

rrk
  • 15,677
  • 4
  • 29
  • 45
Justin
  • 378
  • 1
  • 3
  • 12
  • 1
    A volume mount always replaces what was in the image; it looks like mounting a volume over all of `/opt/coldfusion` is replacing the actual application that's supposed to run. Can you narrow the volume mount to a more specific data directory? – David Maze Jan 20 '22 at 12:33
  • what changes are you making to /opt/coldfusion that you need to persist? – Pete Jan 24 '22 at 16:19
  • I have to add some mapping,datasources, and mail server information in ColdFusion administrator – Justin Jan 25 '22 at 08:07

2 Answers2

2

You shouldn't mount the entire /opt/coldfusion folder to your host system. Only mount the sub-folders that you want to persist (like logs, etc). Below is an example of this from my coldfusion-docker-starter repo (https://github.com/dskaggs/coldfusion-docker-starter):

services:
  coldfusion:
    image: eaps-docker-coldfusion.bintray.io/cf/coldfusion:latest
    env_file: coldfusion.env
    ports:
    - 8500:8500
    - 5005:5005
    volumes:
    - ${PWD}/app:/app
    - ${PWD}/logs/:/opt/coldfusion/cfusion/logs/
    networks: 
      - web

networks:
  web:  

Bind mounts do not have to be limited to directories either. You can mount a specific file from the host to a file in the container as well. For example, this is one way to mount the MySQL driver JAR files into the container so that ColdFusion can access them (I wouldn't do this on production, just providing an example):

volumes:
- ${PWD}/app:/app   
- ${PWD}/data/:/data
- ${PWD}/drivers/mysql-connector-java-8.0.21.jar:/opt/ColdFusion/cfusion/lib/mysql-connector-java-8.0.21.jar

Edit: fixed indentation

Dan S
  • 31
  • 2
0

I found this repo of ColdFusion Docker Images, maintained by none other than Charlie Arehart:

https://github.com/carehart/awesome-cf-compose

Digging into this one shows the mount point for /app located in the repo's folder structure.

# Project structure:

.
├── docker-compose.yml
├── app
    └── test.cfm
    └── dumpserver.cfm

# docker-compose.yml

services:
    coldfusion: 
        image: adobecoldfusion/coldfusion2021:latest
        ports:
        - "8500:8500"
        environment:
            - acceptEULA=YES
            - password=123
        volumes:
            - ./app:/app
Adrian J. Moreno
  • 14,350
  • 1
  • 37
  • 44
  • I've tried the same, but only the app folder mounts. no ColdFusion files. That is, if we made some mappings or added data sources in the CF admin, they will be lost when we do "docker-compose down" – Justin Jan 21 '22 at 08:18