I have a one-machine swarm (i.e. one master node, that's it), which has the following docker-compose.yml
file:
version: "3"
services:
web:
image: rbalicki/hellorocket:latest
ports:
- "8001:8000"
depends_on:
- "db"
environment:
- DATABASE_URL=postgres://docker:docker@db:5432/pw_back
command: cargo run # this runs the server
db:
image: rbalicki/pg:latest
I run the following commands, per the tutorial:
docker-machine create --driver virtualbox myvm1
docker-machine ssh myvm1 "docker swarm init --advertise-addr 192.168.99.100:2377"
docker-machine scp docker-compose.yml myvm1:~
docker-machine ssh myvm1 "docker stack deploy -c docker-compose.yml hellorocketstack"
docker machine ls
gives me an IP of tcp://192.168.99.100:2376
.
The Dockerfile for the web
process definitely exposes 8000, as well. Locally, when I run this server, it connects to port 8000 with no problems. However, within the vm, it doesn't receive any requests when I curl 192.168.99.100:8001
(likewise for 8000
). This is true, even if I kill the vm and completely restart my machine.
However, if I install other services (e.g. visualizer, from the tutorial), they work just fine.
This is driving me crazy! How can I figure out what is going on?
Also, within the vm, I also cannot call curl localhost:8001
(which works for visualizer, at the remapped port). Any help is appreciated! Are there next steps I can take to debug this?
Edit: nc -zv 192.168.99.100 8001
also turns up nothing! (It works for visualizer)
Edit2: docker inspect CONTAINER
shows:
"Config": {
"ExposedPorts": {
"8001/tcp": {}
},
},
"NetworkSettings": {
"Ports": {
"8001/tcp": null
},
}
Which is the same thing as the docker inspect
command shows for the working example (modulo exposed port number)