I’ve converted my
Dockerfiles to habitat plans, but when I run
docker-compose up, the images can’t talk to each other.
I’m getting lines like this:
curl: (7) Failed to connect to localhost port 80: Connection refused
And when an image tries to make a post request to another one, the log output says “connection refused”.
Is there some sort of port mapping I need to do in
I’ve converted my
Sounds like you have an issue, with either a port the package is listening on, or some firewall type issue.
That’s where I’d start to look.
I’m thoroughly confused, because I haven’t added any firewalls.
I haven’t changed the
docker-compose.yml at all.
docker-compose up with images build with
docker build, everything’s happy.
When I do the same thing with images build with
hab studio build, there’s something blocking the networking.
The really confusing thing is the one image not being able to do
localhost:80. No matter what might be going on, it should be able to do that.
Hmm, I’m sorry I was confused by your first post maybe. You are building your artifact, how are you running the artifact as a service? Like in your compose file you could be exporting the ports from one container to another and if you wanted to you could set up your package exports to reflect the same ports. And after you would either want to run the service under a hab supervisor or you could export it to docker (I haven’t tried this yet but I believe this what the docs state) and launching that docker instance should start your service and expose the ports specified.
After I’ve built the project with
hab studio build, I do
hab pkg export docker path/to/hartfile.hart.
The compose file I have has 5 different docker images (4 of which are my habitat projects). The images in that cluster have ports exposed to each other. Something about building the packages with habitat as opposed to straight docker is blocking the networking.
The run hooks all do
exec path/to/binary, so the actual services are all being managed by the hab supervisor.
I’m wondering if it’s some hostname resolution issue that habitat is preventing with the names in the docker compose file. Say
webserver needs to contact
database:3333. With the habitat-generated images, that resolution fails.
I’m taking a look at this page and I think it’s an issue with how I currently have my compose file. I built their habitat image and exported it to docker (along with core/mysql). Everything worked as expected with their compose file.
Okay. After a long day of sysadminning, I figured it out. I started up the cluster, tapped into one of the images, and ran
As it turns out, my service (a go webserver), is only listening on ipv6.
This didn’t happen with straight docker, though.
Any ideas on why that happened/how to fix the issue?