Basil Battikhi
Basil Battikhi

Reputation: 2668

Docker Is supposed to be listening but it doesn't

I deployed my first scala project on docker but i have a problem, the problem is the docker says that the server has been started, but surprisingly it doesn't listen to any request, even i exposed the port to the host, when i tried to request a get, it says that the connection is refused, also i tried to telnet to the port and it seems that there are no listener on port 9000 neither 3200 an 3000, please find bellow what i have wrote in dockerFile

FROM jelastic/sbt
# Env variables
ENV SCALA_VERSION 2.12.4
ENV SBT_VERSION 1.1.0

# Scala expects this file
RUN touch /usr/lib/jvm/java-8-openjdk-amd64/release

# Install Scala
## Piping curl directly in tar
RUN \
  curl -fsL https://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz | tar xfz - -C /root/ && \
  echo >> /root/.bashrc && \
  echo "export PATH=~/scala-$SCALA_VERSION/bin:$PATH" >> /root/.bashrc

# Install sbt
RUN \
  curl -L -o sbt-$SBT_VERSION.deb https://dl.bintray.com/sbt/debian/sbt-$SBT_VERSION.deb && \
  dpkg -i sbt-$SBT_VERSION.deb && \
  rm sbt-$SBT_VERSION.deb && \
  apt-get update && \
  apt-get install sbt && \
  sbt sbtVersion



WORKDIR /
ADD play /
RUN tree /
EXPOSE 9000
CMD sbt run

and my run command was

docker run -p 9000:9000 -t bee while bee is my image name

as you see the server is started properly.

please find bellow the attached picture to be more clearly enter image description here

here is the docker ps enter image description here

Upvotes: 3

Views: 291

Answers (1)

Tarun Lalwani
Tarun Lalwani

Reputation: 146510

enter image description here

If you see your screenshot, it clear states the docker machine is located at 192.168.99.100. So that is the address you need to use.

Open http://192.168.99.100:9000 and it should work

Upvotes: 5

Related Questions