Docker Community Forums

Share and learn in the Docker community.

Issues docker-compose.yml

Hello everyone,
I have a little issue to upgrade the docker-compose.yml from version 2 to 3.8

version: "2"

services:
    alfresco:
        image: alfresco/alfresco-content-repository-community:6.2.0-ga
        mem_limit: 1500m
        environment:
            JAVA_OPTS: "
                -Ddb.driver=org.postgresql.Driver
                -Ddb.username=alfresco
                -Ddb.password=alfresco
                -Ddb.url=jdbc:postgresql://postgres:5432/alfresco
                -Dsolr.host=solr6
                -Dsolr.port=8983
                -Dsolr.secureComms=none
                -Dsolr.base.url=/solr
                -Dindex.subsystem.name=solr6
                -Dshare.host=127.0.0.1
                -Dshare.port=8080
                -Dalfresco.host=localhost
                -Dalfresco.port=8080
                -Daos.baseUrlOverwrite=http://localhost:8080/alfresco/aos
                -Dmessaging.broker.url=\"failover:(nio://activemq:61616)?timeout=3000&jms.useCompression=true\"
                -Ddeployment.method=DOCKER_COMPOSE

                -Dlocal.transform.service.enabled=true
                -DlocalTransform.pdfrenderer.url=http://alfresco-pdf-renderer:8090/
                -DlocalTransform.imagemagick.url=http://imagemagick:8090/
                -DlocalTransform.libreoffice.url=http://libreoffice:8090/
                -DlocalTransform.tika.url=http://tika:8090/
                -DlocalTransform.misc.url=http://transform-misc:8090/

                -Dlegacy.transform.service.enabled=true
                -Dalfresco-pdf-renderer.url=http://alfresco-pdf-renderer:8090/
                -Djodconverter.url=http://libreoffice:8090/
                -Dimg.url=http://imagemagick:8090/
                -Dtika.url=http://tika:8090/
                -Dtransform.misc.url=http://transform-misc:8090/

                -Dcsrf.filter.enabled=false
                -Xms1500m -Xmx1500m
                "

version: "3.8"

services:
	alfresco:
		image: alfresco/alfresco-content-repository-community:6.2.0-ga
		deploy:
			resources:
				limits:
					memory: 1500M
		enviroment:
            JAVA_OPTS: "
                -Ddb.driver=org.postgresql.Driver
                -Ddb.username=alfresco
                -Ddb.password=alfresco
                -Ddb.url=jdbc:postgresql://postgres:5432/alfresco
                -Dsolr.host=solr6
                -Dsolr.port=8983
                -Dsolr.secureComms=none
                -Dsolr.base.url=/solr
                -Dindex.subsystem.name=solr6
                -Dshare.host=127.0.0.1
                -Dshare.port=8080
                -Dalfresco.host=localhost
                -Dalfresco.port=8080
                -Daos.baseUrlOverwrite=http://localhost:8080/alfresco/aos
                -Dmessaging.broker.url=\"failover:(nio://activemq:61616)?timeout=3000&jms.useCompression=true\"
                -Ddeployment.method=DOCKER_COMPOSE

                -Dlocal.transform.service.enabled=true
                -DlocalTransform.pdfrenderer.url=http://alfresco-pdf-renderer:8090/
                -DlocalTransform.imagemagick.url=http://imagemagick:8090/
                -DlocalTransform.libreoffice.url=http://libreoffice:8090/
                -DlocalTransform.tika.url=http://tika:8090/
                -DlocalTransform.misc.url=http://transform-misc:8090/

                -Dlegacy.transform.service.enabled=true
                -Dalfresco-pdf-renderer.url=http://alfresco-pdf-renderer:8090/
                -Djodconverter.url=http://libreoffice:8090/
                -Dimg.url=http://imagemagick:8090/
                -Dtika.url=http://tika:8090/
                -Dtransform.misc.url=http://transform-misc:8090/

                -Dcsrf.filter.enabled=false
                -Xms1500m -Xmx1500m
                "			

When I type the docker-compose up with 3.8 version I get this error.
docker@docker:~/acs-community-deployment/docker-compose$ docker-compose up
ERROR: yaml.scanner.ScannerError: while scanning for the next token
found character ‘\t’ that cannot start any token
in “./docker-compose.yml”, line 12, column 1
The line 12 is: image: alfresco/alfresco-content-repository-community:6.2.0-ga
Thanks in advance

To create automaticly database you can add env variables on db

postgres:
image: postgres:9.4-alpine
ports:
- ‘5432:5432’
environment:
- POSTGRES_DB=h
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
And for hypothesis service : DATABASE_URL=postgres://postgres:postgres@postgres:5432/h

Replace all tabstops in the file with spaces.

Some additional observations:

version: "3.8"

services:
	alfresco:
		...
		deploy:
			resources:
				limits:
					memory: 1500M
		...

This is a deployment constraint for docker swarm. Docker-Compose will ignore it. Now here is the fun part: afair the ressource limit declaration for the v2 specification are invalid in v3 files. Either you will need to use the latest v2.x spec, live without resource contraints, or switch from docker-compose to Docker Swarm deployments.

services:
	alfresco:
		...
		enviroment:
            JAVA_OPTS: "
                -Ddb.driver=org.postgresql.Driver
                ...
                "

Consider switching to Yaml’s folded block scalar style instead of the double quote flow style you used:

services:
	alfresco:
		...
		enviroment:
            JAVA_OPTS: >
                -Ddb.driver=org.postgresql.Driver
                ...

This will result in a merged string without line breaks. See https://yaml-multiline.info/ for further details and comparision of different yaml multiline options.

Thanks everyone for the suggestions, I will try to fix ! Someone know where I can find an example of .yml (latest version) with some typhical cases? Thanks again

Actualy non of the suggestions are secrets. Tekki’s suggestion can be found in the yaml specifications. My first suggestion can be found in the compose file version 3 reference. My second suggestion can be found in the yaml specification as well.

It more or less boils down to the ability to read and understand docs :wink:

heheh you are right thanks :stuck_out_tongue_winking_eye: