emcniece / DockerYourXyzzy

Dockerized Cards Against Humanity clone - https://github.com/ajanata/PretendYoureXyzzy
71 stars 38 forks source link

Does not appear to run when using "--network host" instead of -p #8

Open archer007 opened 4 years ago

archer007 commented 4 years ago

Does not appear to run when using "--network host" instead of -p. Starting up a nginx container worked with "--network host". I'm new to docker so I might be making a newbie config mistake.

emcniece commented 4 years ago

This is a Docker networking issue, not particularly an issue with this repo... but I think Docker-Compose v3 has changed networking a bit since it was written here and the docker-compose.yml file should probably specify container networks instead of leaving them out.

As you probably know alredy, --network host runs containers on your primary network interface and as such exposes all container ports locally so that you don't have to use -p. Can't say I've tested this stack with that configuration, generally host network should be avoided.

If you'd like to share your modified docker-compose.yml file I might be able to help you get it working with Nginx 👍

archer007 commented 4 years ago

That would be awesome! Although I just used nginx as an example. I'm trying to get a Cards server up and running for a game with friends. I'm going to run it as a on-demand server only and it would be really nice to have it dockerized and deployable quickly regardless of future breaking changes to Maven, Tomcat, and the rest.

I was passing command-line arguments instead of customizing docker-compose.yml. Would that mean docker-compose.yml overrode my command line arguments?

I suppose if the default docker network is reachable via my regular network I could just add it to my router's route table and be able to test with the default recommended networking settings, but host networking sounded like it would be easier to troubleshoot and get up and running.

Sorry, I know I'm asking really basic questions. Thank you for helping!

emcniece commented 4 years ago

I was passing command-line arguments instead of customizing docker-compose.yml. Would that mean docker-compose.yml overrode my command line arguments?

Correct. If you specify command: in docker-compose.yml, or if you add commands to docker run ... in terminal, it will override CMD that is baked in to the Dockerfile. You can do it, just make sure you pass the entire command.

If you want to quickly make this accessible to your friends without adding exceptions to your router firewall, check out https://ngrok.com/ - it's a tunnel-as-a-service, and it even provides SSL certs. There's a containerized version at https://github.com/wernight/docker-ngrok.

I'll try and get an example compose for you, sit tight...

emcniece commented 4 years ago

Ok, pushed some updates to master. Check out the README and try the "Run with Docker-Compose" section, and make sure your docker-compose.yml file specifies emcniece/dockeryourxyzzy:3 or that you run docker pull emcniece/dockeryourxyzzy:latest.