isamplesorg / isamples_docker

Location to store resources needed to build iSamples Docker containers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

env file solr port is not used

datadavev opened this issue · comments

The solr port in the .env files is not being used and solr is exposed on an apparently arbitrary port

This was done intentionally as I had assumed that port was only being used in the docker networking stack and not exposed.

I’d initially created that env variable when testing and just forgot to remove it.

Sorry for the confusion.

This was the part of the docker docs that led me to believe that:

It is important to note the distinction between HOST_PORT and CONTAINER_PORT. In the above example, for db, the HOST_PORT is 8001 and the container port is 5432 (postgres default). Networked service-to-service communication uses the CONTAINER_PORT. When HOST_PORT is defined, the service is accessible outside the swarm as well.

I’d thought that omitting HOST_PORT would mean it wasn’t exposed to the world.

Aha, if only a container port is specified in docker-compose, an ephemeral host port is chosen for the host port. 1

That explains why I was seeing solr on odd ports that were incremented each time a container was started.

Footnotes

  1. https://docs.docker.com/compose/compose-file/compose-file-v3/#ports

Aha! Thanks @datadavev this all makes sense now.