3

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
Ragini
  • 1,509
  • 7
  • 28
  • 42

1 Answers1

3
  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
MRousse
  • 526
  • 1
  • 4
  • 9
  • 1
    Also helpful, [docker-compose.yml reference](https://docs.docker.com/compose/compose-file/) – bluescores Feb 16 '18 at 13:33
  • Thanks for your quick response M.Rousse. 1. My docker-compose up doesnt give any error and is run successfully. then why cant I access localhost:4848 or any of the three ports ? 3. Does it mean if I put .ear file in my deployment folder (host), then it will be deployed automatically and I should be able to acess it ? That is not happening with me. :-( – Ragini Feb 16 '18 at 13:35
  • To be honest, I had quite a lot of difficulties using docker with windows, I would suggest you use `docker inspect` to see the IP address of the container and try to access it directly. It should be accessible and you could configure it through the admin interface! (I think it will be Ok once you resolved the network problem) – MRousse Feb 16 '18 at 13:46