Error while build in Docker

I try to build from Docker in windows environment. I have got error like below.

ERROR: The Compose file ‘.\docker-compose.yml’ is invalid because:
webui.environment contains an invalid type, it should be an object, or an array

Hi @sankar

can you post the contents of your docker-compose.yml file here?
I suspect there’s a wrong entry or an incompatible docker-compose version you’re using.

Note that we recommend running docker in Linux, since it’s easier to handle (eg. using a Virtualbox machine if you want to install the Server locally for testing)

Actually am running the docker in windows for testing. Yes you are right, I fixed this issue. Now, its build successfully and populated db also. But I am not able to run. Here is my docker-compose.yml

db:
  build: db
  restart: always
  volumes:
    - ./volumes/db/data:/var/lib/postgresql/data
    - ./volumes/db/log:/var/log/postgresql
    - /etc/localtime:/etc/localtime:ro
    - /etc/timezone:/etc/timezone:ro
  environment:
    - METASFRESH_USERNAME=metasfresh
    - METASFRESH_PASSWORD=metasfresh
    - METASFRESH_DBNAME=metasfresh
    - DB_SYSPASS=System
app:
  build: app
  hostname: app
  links:
    - db:db
    - search:search
  expose:
    - "8282"
    - "61616"
  restart: always
  volumes:
    - ./volumes/app/log:/opt/metasfresh/log:rw
    - /etc/localtime:/etc/localtime:ro
    - /etc/timezone:/etc/timezone:ro
  environment:
    - METASFRESH_HOME=/opt/metasfresh
webapi:
  build: webapi
  links:
    - app:app
    - db:db
    - search:search
# to access the webui-api directly 
# (eg. for debugging or connecting your app to the metasfresh api) 
# uncomment following port:
  ports:
   - "8080:8080" 
  restart: always
  volumes:
    - ./volumes/webapi/log:/opt/metasfresh-webui-api/log:rw
    - /etc/localtime:/etc/localtime:ro
    - /etc/timezone:/etc/timezone:ro
webui:
  build: webui
  links:
    - webapi:webapi
  ports:
    - "80:80"
    - "443:443"
  restart: always
  volumes:
    - /etc/localtime:/etc/localtime:ro
    - /etc/timezone:/etc/timezone:ro
  #uncomment and set to URL where metasfresh will be available from browsers
  environment:
   - WEBAPI_URL=http://localhost:8080/
search:
  build: search
  ulimits:
    memlock:
      soft: -1
      hard: -1
    nofile:
      soft: 65536
      hard: 65536
  cap_add:
    - IPC_LOCK
# to access the search api directly
# (e.g. if you did docker-compose up search to have the deachboard with your locally running metasfresh services)
# uncomment following ports:
# ports:
#   - "9200:9200"
#   - "9300:9300"
  volumes:
    - ./volumes/search/data:/usr/share/elasticsearch/data
    - /etc/localtime:/etc/localtime:ro
    - /etc/timezone:/etc/timezone:ro
  environment:
    - "ES_JAVA_OPTS=-Xms128M -Xmx256m"
  restart: always

( Note from admin: Edited to proper preformatted text )

Looks like you’re conflicting the ports for webapi and webui.

I imagine you will just want to access the webui in your browser on port 8080 without debugging anything, right?

In that case comment out the ports: 8080 part in the section webapi so it looks like this:

  #for accessing the api directly (eg. for debugging or connecting your
  #app to the metasfresh api) uncomment following lines:
  #ports:
    #- "8080:8080"

Then, set webui-ports to expose the http-port to port 8080 so it looks like this:

  ports:
    - "8080:80"
    - "443:443"

Note the 8080 in the webui part. This shall match the port you’re setting in WEBAPI_URL= environment variable.

Then rebuild and try accessing again on http://localhost:8080

Hi @julian.bischof,

Unfortunately it is not work. Here is my error and docker shell.

btw:
here’s how you change the ports of the webui, when using a default/unedited docker-compose.yml: http://docs.metasfresh.org/installation_collection/EN/How_do_I_change_the_webui_ports_for_metasfresh_docker.html

@sankar

can you make sure the webapi and webui parts in your docker-compose.yml look like this:

webapi:
  build: webapi
  links:
    - app:app
    - db:db
    - search:search
# to access the webui-api directly 
# (eg. for debugging or connecting your app to the metasfresh api) 
# uncomment following port:
#  ports:
#   - "8080:8080" 
  restart: always
  volumes:
    - ./volumes/webapi/log:/opt/metasfresh-webui-api/log:rw
    - /etc/localtime:/etc/localtime:ro
    - /etc/timezone:/etc/timezone:ro
webui:
  build: webui
  links:
    - webapi:webapi
  ports:
    - "8080:80"
    - "443:443"
  restart: always
  volumes:
    - /etc/localtime:/etc/localtime:ro
    - /etc/timezone:/etc/timezone:ro
  #uncomment and set to URL where metasfresh will be available from browsers
  environment:
   - WEBAPI_URL=http://localhost:8080/

If it’s already like this and it doesn’t work, can you check if you’re not running old/same docker images as before?
You should be able to check if the ports are correct if nc -vz localhost 8080 succeeds.

Are you sure, it’s running on localhost and not on MC6?
Maybe it’s about this issue: https://forums.docker.com/t/unable-to-access-docker-exposed-port-on-windows-machine/5865

We’re usually running docker-compose in linux native installations (eg. via Ubuntu Server on Virtualbox).
It might prevent a lot of headache to you.

Hi bro,

There is no changes in docker-compose.yml its exactly the same. There is no problem in port itself. Yes am running on localhost only.

I am trying to run in windows locally for testing. Our production environment is Linux, before moving we have check in our local. If you find any other issue let me know. Thanks