Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run docker as bridge mode instead of network mode #140

Open
junjizhi opened this issue Nov 17, 2018 · 6 comments
Open

Run docker as bridge mode instead of network mode #140

junjizhi opened this issue Nov 17, 2018 · 6 comments

Comments

@junjizhi
Copy link
Contributor

Currently docker-compose-dev.yml starts both container as network
mode, it doesn't work that nice because you have to find the ip for
the container to visit the new application. With bridge mode and port
forwarding, you can visit http://localhost:3000 to visit the app.

Screenshot attached

N/A

How to reproduze the user scenario

@alexanmtz
Copy link
Member

Merged and going to deploy @junjizhi, thanks! 🚀

@alexanmtz alexanmtz reopened this Nov 29, 2018
@alexanmtz
Copy link
Member

@junjizhi I had to undo the change in config/database.yml to allow connect to localhost if not using docker, cause db is not mapped. We need to find a way that will not affect a local env without docker

@junjizhi
Copy link
Contributor Author

junjizhi commented Nov 30, 2018

@alexanmtz you can edit your hosts file to point db to 127.0.0.1

@alexanmtz
Copy link
Member

@junjizhi Let's try to figure out a way that don't require changes on hosts

@junjizhi
Copy link
Contributor Author

junjizhi commented Dec 4, 2018

localhost is just an entry in hosts to point to 127.0.0.1. If you remove that entry, your config/database.yml won't work even if it's pointing to localhost.

Pointing it to db, running the app in docker would just work. When running the app locally, they would see an db initialization error. We can document this in README. And I would expect devs are comfortable to edit hosts file.

An alternative is never run rails app in dev environment in Docker (which is super slow anyway). make a separate environment for docker and update config/database.yml. Only run dev in localhost. Having same configs for local and docker won't work unless we make the above tweaks.

@alexanmtz
Copy link
Member

Yeah, I see @junjizhi , it is possible you create a pull request with this changes and I will approve this time? Including the changes on hosts?

Which OS you're using? Windows Mac or Linux?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants