Giter VIP home page Giter VIP logo

Comments (6)

C0Nd3Mnd avatar C0Nd3Mnd commented on September 20, 2024 3

The solution is to not have underscores (_) in the hostname as Java (or whatever) does not seem to support that.

from docker-bungeecord.

itzg avatar itzg commented on September 20, 2024 2

Ah yes, I forget that underscores generally aren’t allowed in hostnames...it’s not just a Java thing:

https://en.m.wikipedia.org/wiki/Hostname#Syntax

It would be nice if Docker compose warned about that in the first place.

from docker-bungeecord.

iverly avatar iverly commented on September 20, 2024

Hey,

Firstly, if you need to see what is the hostname. You can cat /etc/hosts in the container. But, with docker-compose, the host of your others containers is the name of the service. In your case is lobby

Secondly, you don't need to link your lobby with your bungee because docker-compose create a network for you.

And why did you use 20000 as port ? The target port of itzg/docker-minecraft-server is 25565 (https://github.com/itzg/docker-minecraft-server/blob/master/Dockerfile#L27)
If you have changed your port of your Minecraft-server, set it back to 25565 !

With these modifications, your docker-compose.yml look like this:

version: '3.7'

services:
  lobby:
    image: itzg/minecraft-server
    environment:
      EULA: "TRUE"
      TYPE: "PAPER"
      MAX_MEMORY: "4G"
      VERSION: "1.15.2"
      USE_AIKAR_FLAGS: "TRUE"
    volumes:
      - /mc/pc/lobby:/data
    command: --noconsole
    restart: always

  bungee:
    image: itzg/bungeecord
    ports:
      - 25565:25577
    volumes:
      - /mc/pc/bungee/server:/server
    restart: always

And your bungee.yml:

servers:
  lobby:
    motd: ...
    address: lobby:25565
    restricted: false

from docker-bungeecord.

itzg avatar itzg commented on September 20, 2024

To add some background to @iverly 's great feedback, this is the docs that describes the networking feature in docker-compose, which are very cool:

https://docs.docker.com/compose/networking/

from docker-bungeecord.

C0Nd3Mnd avatar C0Nd3Mnd commented on September 20, 2024

I would like to add to this:

My Bungeecord config:

# ...
servers:
  lobby:
    motd: test - lobby
    address: minecraft_lobby:25565
    restricted: false

The docker-compose.yml for Bungeecord:

version: '3'
services:
  bungeecord:
    image: itzg/bungeecord
    container_name: bungeecord
    restart: always
    ports:
      - '25565:25577'
    volumes:
      - ./server:/server

The docker-compose.yml of a Spigot server (minecraft_lobby):

version: '3'
services:
  minecraft_lobby:
    image: itzg/minecraft-server
    container_name: minecraft_lobby
    restart: always
    environment:
      TYPE: SPIGOT
      EULA: 'TRUE'
      MEMORY: 2G
      USE_AIKAR_FLAGS: 'true'
      VERSION: '1.15.2'
      ONLINE_MODE: 'FALSE'
    networks:
      - bungeecord_default
      - default
    volumes:
      - ./data:/data
networks:
  bungeecord_default:
    external: true

And I get the same error as @ColinTree:

09:33:08 [SEVERE] Exception in thread "main"
09:33:08 [SEVERE] java.lang.IllegalArgumentException: Invalid host/address: minecraft_lobby:25565
09:33:08 [SEVERE]     at net.md_5.bungee.Util.getAddr(Util.java:54)
09:33:08 [SEVERE]     at net.md_5.bungee.conf.YamlConfig.getServers(YamlConfig.java:221)
09:33:08 [SEVERE]     at net.md_5.bungee.conf.Configuration.load(Configuration.java:106)
09:33:08 [SEVERE]     at net.md_5.bungee.BungeeCord.start(BungeeCord.java:273)
09:33:08 [SEVERE]     at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:62)
09:33:08 [SEVERE]     at net.md_5.bungee.Bootstrap.main(Bootstrap.java:15)

I can resolve the hostname within a shell (i.e. bash) inside the Bungeecord container:

bash-4.4# nslookup minecraft_lobby
nslookup: can't resolve '(null)': Name does not resolve

Name:      minecraft_lobby
Address 1: 172.18.0.3 minecraft_lobby.bungeecord_default

I tried using minecraft_lobby.bungeecord_default as well, but it wouldn't work.

It works when I use the IP address of the minecraft_lobby server instead of the hostname, like so:

# ...
servers:
  lobby:
    motd: test - lobby
    address: 172.18.0.3:25565
    restricted: false

But that's not a good solution at all, since the IP address could change (container restarts, different setup etc.).

It seems that Bungeecord/Java doesn't resolve internal hostnames properly. Any way to fix this/work around it?

from docker-bungeecord.

github-actions avatar github-actions commented on September 20, 2024

This issue is stale because it has been open 30 days with no activity. Please add a comment describing the reason to keep this issue open.

from docker-bungeecord.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.