0

I'm creating a Dockerfile running a JBOSS EAP 7, see my dockerfile:

FROM mlaccetti/docker-debian-java8
# file author / maintainer
MAINTAINER "Ronaldo Lanhellas" "ronaldo.lanhellas@gmail.com"

USER root
RUN apt-get update;apt-get install sudo -y

RUN adduser --disabled-password --gecos '' docker
RUN adduser docker sudo
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

USER docker
RUN sudo mkdir -p /opt/jboss/jboss-eap-7.0
COPY jboss-eap-7.0 /opt/jboss/jboss-eap-7.0
ENV JBOSS_HOME /opt/jboss/jboss-eap-7.0
RUN sudo chown -R docker:docker /opt/jboss/*;sudo chmod +x /opt/jboss/jboss-eap-7.0/bin/standalone.sh
RUN java -version
#RUN sudo apt-get install default-jdk -y
CMD sudo sh $JBOSS_HOME/bin/standalone.sh

EXPOSE 8080 9990

The jboss-eap-7 start normally, without error in server.log. But trying to access from host machine the address-> http://localhost:8080 i can't access.

Edit 1 Looking inside docker container , this is my IP:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
44: eth0@if45: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
    link/ether 02:42:ac:11:00:02 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.2/16 brd 172.17.255.255 scope global eth0
       valid_lft forever preferred_lft forever

But my network (host) is : 192.168.0.x. Why docker don't use same ip as host ou another ip in same network ? I think that it can be the cause of problem.

Ronaldo Lanhellas
  • 2,975
  • 5
  • 46
  • 92

1 Answers1

1

You need to publish container᾿s ports, like this: docker run -p 8080:8080 mlaccetti/docker-debian-java8

spqa
  • 186
  • 1
  • 11
  • Now it works, but i thought this is not necessary because i used "EXPOSE" command in Dockerfile. not ? – Ronaldo Lanhellas Jul 24 '18 at 02:31
  • pls see this https://stackoverflow.com/questions/22111060/what-is-the-difference-between-expose-and-publish-in-docker – spqa Jul 24 '18 at 02:33