Sensu check return critical but but uchiwa show green - sensu

I have http check on sensu , sensu client return critical but uchiwa show check as green .
check :
"request1":{
"command": "/etc/sensu/plugins/check-http.rb -U XXX -a XXXX -t 5 -q 'OK' -u http://XXXX:8081/helix/v1/unititems/?lang=en&fq=%28seller_ipro_id_ext_ref%3A5139391%29&limit=1",
"interval": 60,
"occurrences": 1,
"refresh": 60 ,
"subscribers": ["helix_check"],
"handlers": [ "NOC","slack" ]
},
output in of uchiwa web application :

Related

How to insert data using docker compose

Overview: I would like to insert data in file.json in db within docker-compose using CURL.
My Try: I have tried to mount file.json inside the FROST container, then run the command CURL within docker-compose.
curl -X POST -H "Content-Type: application/json" -d file.json http://localhost:8080/FROST-Server/v1.1/Things
as the result the docker-compose yaml is so
version: '2'
services:
web:
image: fraunhoferiosb/frost-server:latest
environment:
- serviceRootUrl=http://localhost:8080/FROST-Server
- http_cors_enable=true
- http_cors_allowed.origins=*
- persistence_db_driver=org.postgresql.Driver
- persistence_db_url=jdbc:postgresql://database:5432/sensorthings
- persistence_db_username=sensorthings
- persistence_db_password=ChangeMe
- persistence_autoUpdateDatabase=true
ports:
- 8080:8080
- 1883:1883
volumes:
- ./file.json:file.json
depends_on:
- database
command:
- curl
- -X
- POST
- --data-binary
- ./file.json
- -H
- "Content-Type: application/json" # <-- YAML string quoting
- -H
- "Accept: application/json"
- "http://localhost:8080/FROST-Server/v1.1/Things"
database:
image: postgis/postgis:14-3.2-alpine
environment:
- POSTGRES_DB=sensorthings
- POSTGRES_USER=sensorthings
- POSTGRES_PASSWORD=ChangeMe
volumes:
- postgis_volume:/var/lib/postgresql/data
volumes:
postgis_volume:
After running docker-compuse up, i got this error
Creating network "frost_default" with the default driver
Creating frost_database_1 ... done
Creating frost_web_1 ... done
Attaching to frost_database_1, frost_web_1
database_1 |
database_1 | PostgreSQL Database directory appears to contain a database; Skipping initialization
database_1 |
database_1 | 2022-06-13 11:24:06.420 UTC [1] LOG: starting PostgreSQL 14.3 on x86_64-pc-linux-musl, compiled by gcc (Alpine 10.3.1_git20211027) 10.3.1 20211027, 64-bit
database_1 | 2022-06-13 11:24:06.421 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
database_1 | 2022-06-13 11:24:06.421 UTC [1] LOG: listening on IPv6 address "::", port 5432
database_1 | 2022-06-13 11:24:06.458 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
database_1 | 2022-06-13 11:24:06.486 UTC [22] LOG: database system was shut down at 2022-06-13 09:58:59 UTC
database_1 | 2022-06-13 11:24:06.498 UTC [1] LOG: database system is ready to accept connections
web_1 | % Total % Received % Xferd Average Speed Time Time Time Current
web_1 | Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
web_1 | curl: (7) Failed to connect to localhost port 8080: Connection refused
frost_web_1 exited with code 7
note: docker-compose.yml and file.json are in same path.
file.json
{
"name": "Car",
"description": "Smart connected car equipped with sensors.",
"properties": {
"vin": "5YJ3EDEB5KF223462"
},
"Locations": [
{
"name": "Parking lot",
"description": "The parking lot of the fictive company.",
"encodingType": "application/vnd.geo+json",
"location": {
"type": "Point",
"coordinates": [8.419432640075684, 49.01395040719586]
}
}
],
"Datastreams": [
{
"name": "Oil pump",
"description": "Measuring the motor oil pressure.",
"observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement",
"unitOfMeasurement": {
"name": "Bar",
"symbol": "bar",
"definition": "http://www.qudt.org/qudt/owl/1.0.0/unit/Instances.html#Bar"
},
"Sensor": {
"name": "OIL_PRES_SENSOR2",
"description": "Oil pressure sensor",
"encodingType": "application/pdf",
"metadata": "..."
},
"ObservedProperty": {
"name": "Pressure",
"definition": "http://www.qudt.org/qudt/owl/1.0.0/quantity/Instances.html#Pressure",
"description": "The oil pressure."
},
"Observations": [
{
"phenomenonTime": "2022-01-10T10:00:00Z",
"result": 2.1
},
{
"phenomenonTime": "2022-01-10T10:01:10Z",
"result": 2.3
},
{
"phenomenonTime": "2022-01-10T10:02:20Z",
"result": 2.7
},
{
"phenomenonTime": "2022-01-10T10:03:30Z",
"result": 2.9
},
{
"phenomenonTime": "2022-01-10T10:04:40Z",
"result": 4.1
},
{
"phenomenonTime": "2022-01-10T10:05:50Z",
"result": 3.7
}
]
},
{
"name": "Motor Temperature",
"description": "The temperature of the motor.",
"observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement",
"unitOfMeasurement": {
"name": "Centigrade",
"symbol": "C",
"definition": "http://www.qudt.org/qudt/owl/1.0.0/unit/Instances.html#DegreeCentigrade"
},
"Sensor": {
"name": "DHT22/Temperature",
"description": "Temperature sensor of a DHT22",
"encodingType": "application/pdf",
"metadata": "https://www.sparkfun.com/datasheets/Sensors/Temperature/DHT22.pdf"
},
"ObservedProperty": {
"name": "Temperature",
"definition": "http://www.qudt.org/qudt/owl/1.0.0/quantity/Instances.html#ThermodynamicTemperature",
"description": "The temperature."
},
"Observations": [
{
"phenomenonTime": "2019-03-14T10:00:00Z",
"result": 21.0
},
{
"phenomenonTime": "2019-03-14T10:01:00Z",
"result": 23.1
},
{
"phenomenonTime": "2019-03-14T10:02:00Z",
"result": 40.5
},
{
"phenomenonTime": "2019-03-14T10:03:00Z",
"result": 47.1
},
{
"phenomenonTime": "2019-03-14T10:04:00Z",
"result": 32.2
},
{
"phenomenonTime": "2019-03-14T10:05:00Z",
"result": 30.3
}
]
},
{
"name": "Access",
"description": "The access state (e.g., open, closed) of the vehicle.",
"observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement",
"unitOfMeasurement": {
"name": "Centimeter",
"symbol": "cm",
"definition": "http://www.qudt.org/qudt/owl/1.0.0/unit/Instances.html#Centimeter"
},
"Sensor": {
"name": "Distance Sensor",
"description": "Measure the distance.",
"encodingType": "application/pdf",
"metadata": "..."
},
"ObservedProperty": {
"name": "Length",
"definition": "http://www.qudt.org/qudt/owl/1.0.0/quantity/Instances.html#Length",
"description": "The length of the measured distance."
},
"Observations": [
{
"phenomenonTime": "2019-03-14T10:00:00Z",
"result": 0.0
},
{
"phenomenonTime": "2019-03-14T10:01:00Z",
"result": 0.0
},
{
"phenomenonTime": "2019-03-14T10:02:00Z",
"result": 21.4
},
{
"phenomenonTime": "2019-03-14T10:03:00Z",
"result": 21.7
},
{
"phenomenonTime": "2019-03-14T10:04:00Z",
"result": 20.9
},
{
"phenomenonTime": "2019-03-14T10:05:00Z",
"result": 0.0
}
]
}
]
}
any other solution is welcome too:)
I think you're executing your "curl" command before your "web" container starts. If I were you, I will run the "web" on "0.0.0.0" instead of "localhost", and use separate container to sleep for some time, then execute the curl command (don't forget about the container entrypopoint and override it if required).
I did run your docker-compose and execute the curl manually, but I got 400:
curl -vvv -X POST --data-binary ./file.json -H "Content-Type: application/json" -H "Accept: application/json" "http://localhost:8080/FROST-Server/v1.1/Things"
Note: Unnecessary use of -X or --request, POST is already inferred.
* Trying 127.0.0.1:8080...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8080 (#0)
> POST /FROST-Server/v1.1/Things HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.68.0
> Content-Type: application/json
> Accept: application/json
> Content-Length: 11
>
* upload completely sent off: 11 out of 11 bytes
* Mark bundle as not supporting multiuse
< HTTP/1.1 400
< Access-Control-Allow-Origin: *
< Access-Control-Expose-Headers: Location
< Content-Length: 224
< Date: Tue, 14 Jun 2022 12:43:06 GMT
< Connection: close
<
* Closing connection 0
{"code":400,"type":"error","message":"Unexpected character ('.' (code 46)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')\n at [Source: (BufferedReader); line: 1, column: 2]"}
Since I'm not familiar with this service, I don't know how to fix this, but you can test bellow docker-compose if you could fix this:
version: '2'
services:
curl:
image: alpine/curl:latest
entrypoint: /bin/sh
command:
- -c
- sleep 10
- curl
- -vvv
- -X
- POST
- --data-binary
- /file.json
- -H
- "Content-Type: application/json" # <-- YAML string quoting
- -H
- "Accept: application/json"
- "http://web:8080/FROST-Server/v1.1/Things"
volumes:
- ./file.json:/file.json
depends_on:
- web
web:
image: fraunhoferiosb/frost-server:latest
environment:
- serviceRootUrl=http://0.0.0.0:8080/FROST-Server
- http_cors_enable=true
- http_cors_allowed.origins=*
- persistence_db_driver=org.postgresql.Driver
- persistence_db_url=jdbc:postgresql://database:5432/sensorthings
- persistence_db_username=sensorthings
- persistence_db_password=ChangeMe
- persistence_autoUpdateDatabase=true
ports:
- 8080:8080
- 1883:1883
# volumes:
# - ./file.json:/usr/local/tomcat/file.json
depends_on:
- database
# command:
# - curl
# - -X
# - POST
# - --data-binary
# - ./file.json
# - -H
# - "Content-Type: application/json" # <-- YAML string quoting
# - -H
# - "Accept: application/json"
# - "http://localhost:8080/FROST-Server/v1.1/Things"
database:
image: postgis/postgis:14-3.2-alpine
environment:
- POSTGRES_DB=sensorthings
- POSTGRES_USER=sensorthings
- POSTGRES_PASSWORD=ChangeMe
volumes:
- postgis_volume:/var/lib/postgresql/data
volumes:
postgis_volume:
Edit 1: volume was missing from "curl" container
The End Solution of the problem. I would like to thank #RoohAllahGodazgar for helping me out.
Explanation: we need to have another image as curl image which we can run curl request on it after the FROST server is run. on curl service, we should mount first the dummy data inside the container and after that run sleep 20s so that we make sure that FROST server is run, then run crul method. after that the container will be exited.
version: '2'
services:
curl:
image: alpine/curl:latest
command: sh -c "sleep 20 && curl -X POST -d #/file.json http://web:8080/FROST-Server/v1.1/Things"
volumes:
- ./file.json:/file.json
depends_on:
- web
web:
image: fraunhoferiosb/frost-server:latest
environment:
- serviceRootUrl=http://0.0.0.0:8080/FROST-Server
- http_cors_enable=true
- http_cors_allowed.origins=*
- persistence_db_driver=org.postgresql.Driver
- persistence_db_url=jdbc:postgresql://database:5432/sensorthings
- persistence_db_username=sensorthings
- persistence_db_password=ChangeMe
- persistence_autoUpdateDatabase=true
ports:
- 8080:8080
- 1883:1883
depends_on:
- database
database:
image: postgis/postgis:14-3.2-alpine
environment:
- POSTGRES_DB=sensorthings
- POSTGRES_USER=sensorthings
- POSTGRES_PASSWORD=ChangeMe
volumes:
- postgis_volume:/var/lib/postgresql/data
volumes:
postgis_volume:

sensu-client check-memory sample work working

I am trying to get sensu working.
The following is the sensu-client.log
ubuntu#ip:~$ sudo tail -f /var/log/sensu/sensu-client.log
{"timestamp":"2016-09-27T16:07:37.628182-0400","level":"info","message":"completing checks in progress","checks_in_progress":[]}
{"timestamp":"2016-09-27T16:07:38.128912-0400","level":"info","message":"closing client tcp and udp sockets"}
{"timestamp":"2016-09-27T16:07:38.129275-0400","level":"warn","message":"stopping reactor"}
{"timestamp":"2016-09-27T16:07:39.224377-0400","level":"warn","message":"loading config file","file":"/etc/sensu/config.json"}
{"timestamp":"2016-09-27T16:07:39.224487-0400","level":"warn","message":"loading config files from directory","directory":"/etc/sensu/conf.d"}
{"timestamp":"2016-09-27T16:07:39.224528-0400","level":"warn","message":"loading config file","file":"/etc/sensu/conf.d/check_mem.json"}
{"timestamp":"2016-09-27T16:07:39.224573-0400","level":"warn","message":"config file applied changes","file":"/etc/sensu/conf.d/check_mem.json","changes":{}}
{"timestamp":"2016-09-27T16:07:39.224618-0400","level":"warn","message":"applied sensu client overrides","client":{"name":"localhost","address":"127.0.0.1","subscriptions":["test","client:localhost"]}}
{"timestamp":"2016-09-27T16:07:39.230963-0400","level":"warn","message":"loading extension files from directory","directory":"/etc/sensu/extensions"}
{"timestamp":"2016-09-27T16:07:39.231048-0400","level":"info","message":"configuring sensu spawn","settings":{"limit":12}}
/etc/sensu/client.json contains
{
"rabbitmq": {
"host": "ipaddressofsensuserver",
"port": 5672,
"user": "username",
"password": "password",
"vhost": "/sensu"
},
"api": {
"host": "localhost",
"port": 4567
},
"checks": {
"test": {
"command": "echo -n OK",
"subscribers": [
"test"
],
"interval": 60
},
"memory-percentage": {
"command": "check-memory-percent.sh -w 50 -c 70",
"interval": 10,
"subscribers": [
"test"
]
}
},
"client": {
"name": "localhost",
"address": "127.0.0.1",
"subscriptions": [
"test"
]
}
}
I have copied check-memory-present.sh into /etc/sensu/conf.d folder
I was expecting the log file to run check-memory-percent every 10 seconds. What am I missing here ?
The Sensu client cannot operate entirely independent of the server, but it can schedule its own checks to run and have them be sent to the server through the transport (RabbitMQ in this case). You'll have to add "standalone": true to the check configuration in order to have this take effect, and then restart the sensu-client service.
So, the file /etc/sensu/conf.d/check_mem.json should look something like:
"checks": {
"memory-percentage": {
"command": "/etc/sensu/conf.d/check-memory-percent.sh -w 50 -c 70",
"interval": 10,
"standalone": true
}
}
Remember to remove the block from /etc/sensu/client.json as well, as you may get unexpected results if you have the same check name defined multiple times.
In Client.json, under "client", you need to add the subscriptions. Like in the example here. It should match the definition of "subscribers" for your check.

Doubts about notifications format in Orion usin APIv2

we are testing the subscription functionality using the APIv2. We are following the guidelines described in http://telefonicaid.github.io/fiware-orion/api/v2/ . We are able to create a correct subscription but the format of the notification messages that we received is not what we expected. The format of these messages is like the APIv1 version. Is this the expected behavior?
We are using the Docker image from https://hub.docker.com/r/fiware/orion/.
Version information about the build:
{
"orion" : {
"version" : "1.0.0-next",
"uptime" : "0 d, 1 h, 28 m, 47 s",
"git_hash" : "a729812c45d2749fffbc19add17631b2fffc8797",
"compile_time" : "Fri Apr 8 10:05:55 UTC 2016",
"compiled_by" : "root",
"compiled_in" : "838a42ae8431"
}
}
Steps to reproduce:
Create an entity:
(curl -X POST http://<cb_url>:<cb_port>/v2/entities?options=keyValues -s -S --header 'Content-Type: application/json' \
--header 'Accept: application/json' -d #- | python -mjson.tool) <<EOF
{
"type":"Room",
"id": "test",
"humidity":40
}
EOF
Create a subscription:
(curl -X POST http://<cb_url>:<cb_port>/v2/subscriptions -s -S --header 'Content-Type: application/json' \
--header 'Accept: application/json' -d #- | python -mjson.tool) <<EOF
{
"description": "One subscription to rule them all",
"subject": {
"entities": [
{
"idPattern": ".*",
"type": "Room"
}
],
"condition": {
"attributes": [
"humidity"
],
"expression": {
"q": "humidity>40"
}
}
},
"notification": {
"callback": "http://192.168.99.1:5000",
"attributes": [
"humidity"
],
"throttling": 5
},
"expires": "2016-05-05T14:00:00.00Z"
}
EOF
Update attribute.:
(curl -X PUT <cb_url>:<cb_port>/v2/entities/test/attrs/humidity/value -s -S --header 'Content-Type: application/json' \
--header 'Accept: application/json' -d #- | python -mjson.tool) <<EOF
{
"value": 50
}
EOF
We get the notification with the following format:
{u'contextResponses': [
{u'contextElement': {
u'attributes': [{
u'name': u'humidity',
u'type': u'none',
u'value': {u'value': 50}
}],
u'id': u'test',
u'isPattern': u'false',
u'type': u'Room'
},
u'statusCode': {
u'code': u'200',
u'reasonPhrase': u'OK'
}}],
u'originator': u'localhost',
u'subscriptionId': u'5707b72882fc213130f4e5b9'}
NGSIv2 notification formats have not been yet implemented (at Orion 1.0.0). Note that NGSIv2 is yet in beta status and sometimes the specification (where the new notification format has been defined) is a step forward the implementation.
There is a github issue about this, to which you can subscribe in order to know when this feature gets implemented.
EDIT: NGSIv2 notification formats have been implemented in Orion 1.1.0.

could not process input request on the Proton server, the input stream is down due to:invalid stream header: 504F5354

I have deployed Proton and a docker image of Orion in the same Ubuntu server.
When Orion is sending events to Proton I'm getting the following failure
PM com.ibm.hrl.proton.server.adapter.eventHandlers.RequestHandler run
INFO: run: could not process input request on the Proton server, the input stream is down due to:invalid stream header: 504F5354
My server is running Ubuntu 14.04, tomcat7 and java 8
And the subscription sent to Orion to get events to Proton is the following
(curl 192.168.90.3:1026/v1/subscribeContext?notifyFormat=xml -s -S --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Fiware-Service: ct_stc' -d #- | python -mjson.tool) <<EOF
{
"entities": [
{
"type": "STCSensor",
"isPattern": "false",
"id": "605222424"
}
],
"reference": "http://192.168.90.3:3002/ProtonOnWebServer/rest/events",
"duration": "P1M",
"notifyConditions": [
{
"type": "ONCHANGE",
"condValues": [
"Serial",
"BatteryLevel",
"CurrentRSSI",
"LastPacketRSSI",
"LastPacketSNR",
"OzoneCal"
]
}
],
"throttling": "PT1S"
}
EOF
Adding POST similar to the one received by Proton
POST /test/xml.php HTTP/1.1" 200 168 "-" "orion/0.24.0-next libcurl/7.19.7
<notifyContextRequest>
<subscriptionId>56279a61e4ea5f2df9a9eebc</subscriptionId>
<originator>localhost</originator>
<contextResponseList>
<contextElementResponse>
<contextElement>
<entityId type="STCSensor" isPattern="false">
<id>605222424</id>
</entityId>
<contextAttributeList>
<contextAttribute>
<name>Altitude</name>
<type>integer</type>
<contextValue>720</contextValue>
</contextAttribute>
...
And logs in Orion
orion_1 | INFO#14:40:04 httpRequestSend.cpp[199]: Starting transaction to 192.168.90.3:3002/ProtonOnWebServer/rest/events
orion_1 | INFO#14:40:04 connectionOperations.cpp[307]: Database Operation Successful (insert: { _id: ObjectId('5627a3c4e4ea5f2df9a9eebe'), expiration: 1448030404, reference: "http://192.168.90.3:3002/ProtonOnWebServer/rest/events", throttling: 1, servicePath: "/#", entities: [ { id: "705222424", type: "STCSensor", isPattern: "false" } ], attrs: [], conditions: [ { type: "ONCHANGE", value: [ "Serial", "BatteryLevel", "CurrentRSSI", "LastPacketRSSI", "LastPacketSNR"] } ], lastNotification: 1445438404, count: 1, format: "XML" })
orion_1 | INFO#14:40:04 rest.cpp[467]: Transaction ended
orion_1 | WARNING#14:40:04 httpRequestSend.cpp[435]: Notification failure for 192.168.90.3:3002 (curl_easy_perform failed: Failure when receiving data from the peer)
orion_1 | INFO#14:40:04 httpRequestSend.cpp[452]: Transaction ended
Is anything wrong in the subscription?
Thanks for your help

Jboss 5.1 in Dockerfile - how to reach the server in a browser

I have a dockerfile which looks like this:
FROM ubuntu:trusty
RUN DEBIAN_FRONTEND=noninteractive apt-get -yq upgrade
# Update to 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 the 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 to different Java installations
ENV JAVA_HOME /usr/lib/jvm/java-6-oracle
ENV JAVA6_HOME /usr/lib/jvm/java-6-oracle
# Ensure Java 6 is the 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 to reduce the image size
RUN apt-get clean
EXPOSE 8080
i build it than with:
sudo docker build -t dockerfile .
everything builds fine. so I start the server with:
sudo docker run -it --publish 127.0.0.1:8080:8080 dockerfile:latest
I can see that the server starts correctly
If I enter the URL 127.0.0.1:8080 i got an error site:
the connection was reset - the connection to the server was reset
while the page was loading
How do I get a connection to the server in my browser?
The inspect of my container looks like 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:
the 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) for 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:
As far as i understood, I bind my server to 127.0.0.1:8080 with the start command:
sudo docker run -it --publish 127.0.0.1:8080:8080 dockerfile:latest
If I look with ifconfig i have the 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
UP 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 with $ sudo docker inspect --format "{{ .NetworkSettings.IPAddress }}" 054
i get 172.17.0.5
But I also get no connection in my browser with the URL 172.17.0.5:8080 or URL 172.17.42.1:8080
also if I start with $ sudo docker run -d --publish 172.17.42.1:8080:8080 dockerfile:latest (the ifconfig IP) I will not get a connection (and still no reaction on the 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 is JBoss not Docker. JBoss listen per default only to localhost:8080 Jboss only works on localhost:8080 ,but doesnt reply when called by ip (I'm not a JBoss guy so you have to try "-b 0.0.0.0" or to provide a server.xml via ADD in your Dockerfile).
When you run (in my case I called the container jboss)
sudo docker exec jboss apt-get install curl -y
sudo docker exec jboss curl localhost:8080
you notice that JBoss runs and is accessable.