Search code examples
dockerdocker-composepayara

Payara server in Docker-compose up


I am pretty new to Docker and trying to understand it. I have a docker-compose.yml file which contains certain things which I am unclear about. (I have recevied it from client and trying to run/understand it). Please note that I am using windows 10 and Docker version 3.0.

1) What does following piece of code in docker-compose.yml mean ? will it build the vvv.payara image and then start payara on port 4848 ? if yes then, should I be able to open admin page localhost:4848 after doing docker-compose up?

payara:
        image: vvv.payara:rc1
        build: payara
        ports:
          - 4848:4848
          - 8080:8080
          - 8181:8181

2) what is the point of aspecifying three ports for payara ? 4848, 8080 and 8181 ? does it say that if first is occupied start payara on other ?

3) what does line - ./deployments:/opt/payara41/deployments do ? why there is opt folder specified although I am using windows 10 ? I assume opt dir exists on Linux machines.

payara:
    image: vvv.payara:rc1
    build: payara
    ports:
      - 4848:4848
      - 8080:8080
      - 8181:8181
    volumes:
      - ./deployments:/opt/payara41/deployments
      - ./logs:/opt/payara41/glassfish/domains/payaradomain/logs
      - ./vvvConfiguration:/opt/vdz/config
    working_dir: /opt/payara41/bin/
    environment:
      - PAYARA_DOMAIN=payaradomain

Solution

    1. The build parameter specifies the folder docker will use to build the application (cf. doc). The list of ports indicates a port exposure of the docker on the host system. This way, you should access ports 4848, 8080 and 8181 of the docker container on localhost
    2. These three ports are required to access all components of payara. They will all be used for different services (of payara) if the ports are available on the host system. (The port 4848 is the admin HTTPS interface the 8080 the HTTP listener and the 8181 is the HTTPS listener)
    3. Those lines are declaring mount points, that behaves like shared folders, between the host and the container. The part before the : refers to the folder on the host and the second part the folder inside the container that it will be linked to. This means that your folder deployments will be accessible inside the container in the folder /opt/payara41/deployments