-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
Docker integration #1
Comments
I was thinking something similar with Kubernetes too. Maybe it can also be applied to docker too. |
Maybe we can create an image which mounts the host file and add the project IPs once it started? I think docker-compose can pass the project name into the container. Question is then, how to handle the project shutdown. Gonna try to figure out some things now and gonna write my idea here. |
I'm reading a bit about the way you can get The command I'm using to test is this:
From Go is easy to read/parse that info (it can be exported as JSON as well), and setup a profile based from that info. I'll give it a try. |
@fabiang this already implemented on Give it a try and send any feedback. Thanks! |
I've tested it and it works, when I assume that What I was trying as well, was to manipulate my hosts file once a project is started or stopped with First I made a Dockerfile and an entrypoint script, which you can find here: I've build the Docker image and added hostsctl as container to two of my projects in the version: "2"
services:
# ...
hostctl:
image: guumaster/hostctl
environment:
- PROJECT_NAME=test
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "$HOME/.etchosts:/home/hostctl/.etchosts"
- "/etc/hosts:/etc/host-hosts" The result in the /etc/hosts is then:
I can then open http:https://foo_nginx_1.loc and browse the page. Of cause there some problems:
To make this automatically work when a project is started or stopped hostctl could do the following:
To override the path to the hosts file and hostctl config for Windows the user must override the settings in |
I just recently added a For example: It will run until you send UPDATE: Now is documented and you can read about here Guides > Ephemeral profiles Let me know if the |
@fabiang I'm closing this. If you think there is something that can be improved, open a new issue. Thanks! |
Any ideas how to integrate this with Docker?
I need something that recognizes when a container starts and add then a hostname to the hosts file with the ip of the container (maybe the project name from docker-compose). Would be fantastic to automate, so I don’t have to remember all the service names and there port redirections.
The text was updated successfully, but these errors were encountered: