Error with DREMIO_JAVA_EXTRA_OPTS in .env file

Hey,

I am using dremio 20.1.0 in a docker environment with a docker-compose file:

...
  dremio-app:
    container_name: dremio_app
    env_file: .env-dremio
    image: dremio/dremio-oss:20.1.0
    ports:
      - 9047:9047
      - 31010:31010
      - 45678:45678
    expose:
      - "9047"
    volumes:
      - dremio_app:/opt/dremio/data
      - ./dremio/backup:/tmp/backup:z
    restart: unless-stopped
    depends_on:
      - dremio-app-init

When starting up on CentOS 8.5 with podman 4.0.2 I run into the problem, that the Name Resolution seems to be failing with following error messages:

I suspect there is a problem with IPv6 resolution. Therefore I wanted the dremio container to use IPv4 instead. I therefore use the .env file which looks like this

.....
# Extra Java options - shared between dremio and dremio-admin commands
#
DREMIO_JAVA_EXTRA_OPTS='-Djava.net.preferIPv4Stack=true'

# Extra Java options - client only (dremio-admin command)
#
#DREMIO_JAVA_CLIENT_EXTRA_OPTS=

# Extra Java options - server only (dremio command)
#
#DREMIO_JAVA_SERVER_EXTRA_OPTS=

Now when starting I get the following error:

Error: Could not find or load main class '-Djava.net.preferIPv4Stack=true'

what is the right way to pass these variables to dremio?

Okay, after some further troubleshooting I noticed, that dremio tries to resolve its container_id 65820edae8c which is random at every podman-compose up, but in the etc/hosts file there is only the resolution for the container_names…

So I could fix the issue by adding following line to the docker-compose.yml file:

...
  dremio-app:
    hostname: dremio-app # add this line 
    container_name: dremio_app
    env_file: .env-dremio
    image: dremio/dremio-oss:20.1.0
    ports:
      - 9047:9047
      - 31010:31010
      - 45678:45678
    expose:
      - "9047"
    volumes:
      - dremio_app:/opt/dremio/data
      - ./dremio/backup:/tmp/backup:z
    restart: unless-stopped
    depends_on:
      - dremio-app-init

now dremio does not try to resolve the random alphanumeric combination, but rather dremio-app which is resolved via the /etc/hosts file correctly.