Expected behavior
Expected to be able to reach to my service in docker
Actual behavior
Unable to reach to my service in docker
Steps to reproduce the behavior
- docker run -d -p 127.0.0.1:9292:9292 my_app
- get into my docker by using “docker-machine ssh default” and "sudo docker exec -i -t {containter_id} bash
- verified that my_app is indeed running
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 5.7 185332 58716 ? Ssl 00:53 0:01 ruby /usr/local/bundle/bin/rackup <— my_app
root 7 0.4 0.3 20220 3188 ? Ss 01:26 0:00 bash
root 12 0.0 0.2 17492 2160 ? R+ 01:26 0:00 ps aux - verified that I am able to make post to my service in container in bash
- run docker ps and unable to reach to my service
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d5aa8769b845 my_app “/bin/sh -c rackup” 3 seconds ago Up 2 seconds 127.0.0.1:9292->9292/tcp goofy_snyder
98de66a308b4 nginx “nginx -g 'daemon off” 7 hours ago Up 7 hours 443/tcp, 0.0.0.0:8000->80/tcp happy_almeida
try to localhost:9292 it will not work, however localhost:8000 works just fine
I wonder if there’s something wrong that I did by looking at PORTS since they are different… Can someone please provide me a hint?