MitchTalmadge / AMP-dockerized

CubeCoders AMP in a Docker Image. Easily create game servers for games like Minecraft, GMod, TF2, Factorio, and StarBound!
https://hub.docker.com/r/mitchtalmadge/amp-dockerized
Other
89 stars 21 forks source link

no connectivity at start? not sure what's wrong tbh #109

Open kieeps opened 2 years ago

kieeps commented 2 years ago

I haven't run this container in a while but decided i wanted to set up a couple of gameservers again.... i don't know if my compose-file has changed a lot since then but when ever i try to start amp the output shows this: [Error] The specified IP binding address (0.0.0.0) does not have a functioning internet connection (couldn't ping google.com) - please check the network settings for this address and try again.

is it possible to specify the interface/ip instead of 0.0.0.0?

all though i can ping google from the containers once it's started:

docker exec amp-linux hostname -I               
192.168.1.224 

docker exec amp-linux ping -I 0.0.0.0 google.com
PING google.com (142.250.74.14) from 192.168.1.224 : 56(84) bytes of data.
64 bytes from arn09s21-in-f14.1e100.net (142.250.74.14): icmp_seq=1 ttl=56 time=5.21 ms
64 bytes from arn09s21-in-f14.1e100.net (142.250.74.14): icmp_seq=2 ttl=56 time=5.22 ms
64 bytes from arn09s21-in-f14.1e100.net (142.250.74.14): icmp_seq=3 ttl=56 time=5.29 ms
64 bytes from arn09s21-in-f14.1e100.net (142.250.74.14): icmp_seq=4 ttl=56 time=5.21 ms

but it doesn't seem to start properly due to this, the container is running but i cant reach the GUI.

this is the compose:

version: "3"
services:
  other-services:
  .....
 ......
 ......
 ......

  amp-linux:
    container_name: amp-linux
    image: mitchtalmadge/amp-dockerized:latest
    mac_address: 02:42:AC:0B:76:48
    ports:
      - 8080-65535
    volumes:
      - /mnt/zNVME/Docker/AMP-linux/:/home/amp/.ampdata
      - /mnt/zSSD/:/mnt/zSSD
      - /mnt/Tank/:/mnt/Tank
    environment:
      - UID=1000
      - GID=1000
      - TZ=Europe/Stockholm
      - MODULE=ADS
    env_file:
      - amp.env
    networks:
      static:
        ipv4_address: 192.168.1.224
    restart: unless-stopped

networks:
  static:
    driver: macvlan
    driver_opts:
      parent: eth0
    ipam:
      config:
        - subnet: 192.168.1.0/24
          gateway: 192.168.1.1
  Tank:
    driver: bridge
    ipam:
      driver: default
MitchTalmadge commented 2 years ago

Thank you for contributing #110! I have merged your changes and released the new images as v20 (latest). Please let me know if your problem is resolved by the IPBINDING variable you contributed. Remember that the variable only applies on first-creation of the Main instance, so you will need to either re-create your Main instance by deleting the contents of the volume, or you could modify the configuration files inside the instance directory on the volume if you don't want to re-create it, and change the IP there.

kieeps commented 2 years ago

yea i created a test instance and, although the IPBINDING worked, it didn't solve my issue, but i honestly don't think the problem is in the container or AMP :)

Thanks for merging my PR though :D it was my first accepted PR so i guess i'm a programmer now B-)

Anyway...

I only get the error during first start, before there is a Main instance. More specifically during the "# Create Main Instance if not exists" phase of the main.sh script. But i cant see anything in that script that would mess with networking, I haven't done any in-depth research to how the docker networking stack operates when starting a container so i cant tell you what's wrong, but I don't doubt that the problem is somewhere within my compose file ':) As i said in the OP, as soon as it's started it seems to have connectivity. but by then it's to late since connectivity is needed to create the Main instance.

I manually created a Main instance in a VM running AMP un-containerized and moved it to the containers .amp mounted folder and it starts up as expected :)

It's definitely a weird behavior but absolutely not a deal breaker, a lil' bit of extra effort to have this app containerized is 100% worth it :) this seems to be a edge case though, i have been messing with different networks a lot lately.

Thanks for all the work keeping everything up to date :)

Ashram56 commented 2 years ago

Well it would seem I'm running into a similar issue, exactly same symptom. I can ping google from within the container, but at boot the log states it does not have a connection, and I can't get the WebUI

Running on a Synology NAS

I did the extra steps outlined by the original poster (ie creating an AMP instance by running it first in a Ubuntu VM, before transferring over the content of the .ampdata folder in the VM to the docker mount point), and "voila", I could access the web UI

MitchTalmadge commented 2 years ago

Hi, I believe this problem is fixed now on the latest build. It looks like AMP changed some command syntax without announcing or documenting it.

kieeps commented 2 years ago

Oh nice, i can try a fresh spin later today to verify 🙂

Maypul commented 1 year ago

@MitchTalmadge hi there, using the latest tag seems the "issue" is still present, I also get the same error as the folks above and the webui is not coming up. Also running on synology NAS same as @Ashram56.

spider-one commented 6 months ago

I had the same issue running this container on Podman. Podman is rooteless by default and does not allow certain network privileges for containers, which I believe is preventing the successful ping. To get the internet check to be successful I needed to add --cap-add=NET_RAW to my run command. For docker compose I believe the updated compose would be as seen below but I have not tested it.

# This configuration creates one ADS instance, which can be used to create multiple "child" instances.
# This is a good choice if you want to run multiple game servers, even of different types.
version: "3"
services:
  amp:
    container_name: amp
    image: mitchtalmadge/amp-dockerized:latest
    cap_add:
      - NET_RAW
    mac_address: 02:42:AC:XX:XX:XX # Please see the README about this field.
    ports:
      - 8080:8080
      - 25565:25565 # Example port for Minecraft Java server.
      - 27015:27015/udp # Example port for GMod/TF2/etc. source game servers. (Notice how it uses UDP, not TCP.)
      # Add more ports as needed for whatever game servers you'll be running.
      # Create the game instances through the ADS web UI.
    volumes:
      - ./ampdata:/home/amp/.ampdata
    environment:
      - "UID=120" # Change according to which user on the host will own the ampdata volume.
      - "GID=124"
      - "TZ=Etc/UTC" # https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
      - "LICENCE=#########-####-#####-##########"
      - "MODULE=ADS"
    restart: unless-stopped

In my case I'm using Podman systemd units (quadlets) and so have added a line for AddCapability=CAP_NET_RAW which sorted it out.

TechnoSwiss commented 4 months ago

Just switched over to docker rootless and I'm running into this same issue... adding Cap_add NET_RAW to the docker-compose.yaml didn't solve the issue, but I think I might need to read through the docker rootless documentation for ping.

TechnoSwiss commented 4 months ago

That was it, had to follow dockers instructions for enabling ping in the rootless config and then adding cap_add NET_RAW to docker-compose.yaml fixed the issue for me.