docker - Jboss 5.1 in Dockerfile - how to reach the server in a browser -
i have dockerfile looks this:
from ubuntu:trusty run debian_frontend=noninteractive apt-get -yq upgrade # update latest run echo "deb http://archive.ubuntu.com/ubuntu trusty main universe" > /etc/apt/sources.list run echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" > /etc/apt/sources.list.d/webupd8team-java.list run apt-key adv --keyserver keyserver.ubuntu.com --recv-keys c2518248eea14886 run apt-get update run apt-get upgrade -y # install basics # run apt-get install -y python-software-properties software-properties-common unzip run apt-get install -y unzip # install java, auto-accepting license # run add-apt-repository -y ppa:webupd8team/java # run apt-get update # run echo oracle-java6-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections # run apt-get install -y oracle-java6-installer run echo oracle-java6-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections # install different java versions run debian_frontend=noninteractive apt-get install -yq oracle-java6-installer # set environment variables pointing different java installations env java_home /usr/lib/jvm/java-6-oracle env java6_home /usr/lib/jvm/java-6-oracle # ensure java 6 default version run update-java-alternatives -s java-6-oracle # install jboss 5.1.0.ga run wget -o jboss.zip http://sourceforge.net/projects/jboss/files/jboss/jboss-5.1.0.ga/jboss-5.1.0.ga-jdk6.zip/download run unzip jboss.zip && mv jboss-5.1.0.ga /opt run cd /opt/jboss-5.1.0.ga/bin && chmod +x *.sh cmd /opt/jboss-5.1.0.ga/bin/run.sh # clean-up reduce image size run apt-get clean expose 8080
i build with:
sudo docker build -t dockerfile .
everything builds fine. start server with:
sudo docker run -it --publish 127.0.0.1:8080:8080 dockerfile:latest
i can see server starts correctly
if enter url 127.0.0.1:8080
got error site:
the connection reset - connection server reset while page loading
how connection server in browser?
the inspect of container looks this:
[{ "args": [ "-c", "/opt/jboss-5.1.0.ga/bin/run.sh" ], "config": { "attachstderr": false, "attachstdin": false, "attachstdout": false, "cmd": [ "/bin/sh", "-c", "/opt/jboss-5.1.0.ga/bin/run.sh" ], "cpushares": 0, "cpuset": "", "domainname": "", "entrypoint": null, "env": [ "path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "java_home=/usr/lib/jvm/java-6-oracle", "java6_home=/usr/lib/jvm/java-6-oracle" ], "exposedports": { "8080/tcp": {} }, "hostname": "054aaccfd754", "image": "dockerfile:latest", "memory": 0, "memoryswap": 0, "networkdisabled": false, "onbuild": null, "openstdin": false, "portspecs": null, "securityopt": null, "stdinonce": false, "tty": false, "user": "", "volumes": null, "workingdir": "" }, "created": "2014-11-27t11:35:34.538502513z", "driver": "aufs", "execdriver": "native-0.2", "hostconfig": { "binds": null, "capadd": null, "capdrop": null, "containeridfile": "", "devices": [], "dns": null, "dnssearch": null, "extrahosts": null, "links": null, "lxcconf": [], "networkmode": "bridge", "portbindings": { "8080/tcp": [ { "hostip": "172.17.42.1", "hostport": "8080" } ] }, "privileged": false, "publishallports": false, "restartpolicy": { "maximumretrycount": 0, "name": "" }, "volumesfrom": null }, "hostnamepath": "/var/lib/docker/containers/054aaccfd7544a0c14a9f53f94ea2be0c2d6d58437c5311f6507ce2e4466bfa7/hostname", "hostspath": "/var/lib/docker/containers/054aaccfd7544a0c14a9f53f94ea2be0c2d6d58437c5311f6507ce2e4466bfa7/hosts", "id": "054aaccfd7544a0c14a9f53f94ea2be0c2d6d58437c5311f6507ce2e4466bfa7", "image": "f820f5fe9d26c8e896b9d902492ba66f8ed679792047c9c3147b7045df0ed98f", "mountlabel": "", "name": "/sleepy_franklin", "networksettings": { "bridge": "docker0", "gateway": "172.17.42.1", "ipaddress": "172.17.0.5", "ipprefixlen": 16, "macaddress": "02:42:ac:11:00:05", "portmapping": null, "ports": { "8080/tcp": [ { "hostip": "172.17.42.1", "hostport": "8080" } ] } }, "path": "/bin/sh", "processlabel": "", "resolvconfpath": "/var/lib/docker/containers/054aaccfd7544a0c14a9f53f94ea2be0c2d6d58437c5311f6507ce2e4466bfa7/resolv.conf", "state": { "exitcode": 0, "finishedat": "0001-01-01t00:00:00z", "paused": false, "pid": 4236, "restarting": false, "running": true, "startedat": "2014-11-27t11:35:35.120814905z" }, "volumes": {}, "volumesrw": {} }
edit after jottrs answers: logs says:
.... 11:36:32,963 info [tomcatdeployment] deploy, ctxpath=/admin-console 11:36:33,067 info [config] initializing mojarra (1.2_12-b01-fcs) context '/admin-console' 11:36:38,001 info [tomcatdeployment] deploy, ctxpath=/ 11:36:38,068 info [tomcatdeployment] deploy, ctxpath=/jmx-console 11:36:38,232 info [http11protocol] starting coyote http/1.1 on http-127.0.0.1-8080 11:36:38,314 info [ajpprotocol] starting coyote ajp/1.3 on ajp-127.0.0.1-8009 11:36:38,341 info [serverimpl] jboss (microcontainer) [5.1.0.ga (build: svntag=jboss_5_1_0_ga date=200905221634)] started in 1m:1s:805ms
nothing more....
because of jottrs ip mention: far understood, bind server 127.0.0.1:8080
start command:
sudo docker run -it --publish 127.0.0.1:8080:8080 dockerfile:latest
if ifconfig have docker file running on:
$ ifconfig docker0 link encap:ethernet hardware adresse 56:84:7a:fe:97:99 inet adresse:172.17.42.1 bcast:0.0.0.0 maske:255.255.0.0 inet6-adresse: fe80::5484:7aff:fefe:9799/64 gültigkeitsbereich:verbindung broadcast running multicast mtu:1500 metrik:1 rx-pakete:86 fehler:0 verloren:0 Überläufe:0 fenster:0 tx-pakete:101 fehler:0 verloren:0 Überläufe:0 träger:0 kollisionen:0 sendewarteschlangenlänge:0 rx-bytes:4983 (4.9 kb) tx-bytes:12056 (12.0 kb)
but $ sudo docker inspect --format "{{ .networksettings.ipaddress }}" 054
172.17.0.5
but no connection in browser url 172.17.0.5:8080
or url 172.17.42.1:8080
also if start $ sudo docker run -d --publish 172.17.42.1:8080:8080 dockerfile:latest
(the ifconfig ip) not connection (and still no reaction on logs)
$ sudo docker exec -it 228 bash root@22870ce4265e:/# cat /etc/hosts 172.17.0.6 22870ce4265e 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters
the problem jboss not docker. jboss listen per default localhost:8080 jboss works on localhost:8080 ,but doesnt reply when called ip (i'm not jboss guy have try "-b 0.0.0.0" or provide server.xml via add in dockerfile).
when run (in case called container jboss)
sudo docker exec jboss apt-get install curl -y sudo docker exec jboss curl localhost:8080
you notice jboss runs , accessable.
Comments
Post a Comment