i’m using
Ubuntu Desktop 20.04
running on physical machine not VM
My expresss app
var express = require('express')
var app = express()
//Define request response in root URL (/)
app.get('/', function (req, res) {
res.send('Hello test2!')
})
//Launch listening server on port 8081
app.listen(8081, function () {
console.log('app listening2 on port 8081!')
})
My Dockerfile
FROM node:latest
WORKDIR /app
COPY package.json /app
RUN npm install
COPY . /app
CMD [ "npm", "start" ]
EXPOSE 8081
How i run my app
docker run -it --rm -p 0.0.0.0:8081:8081 dockerhubimage
what i can access but its only on a same machine
http://172.17.0.1:8081
and i can access http://172.17.0.2:8081 aswell
My network list
005625396d17 bridge bridge local
6cf957bd1639 host host local
496bb750ef86 my_bridge bridge local
018ebf8845e5 none null local
When doing docker inspect bridge
[
{
"Name": "bridge",
"Id": "005625396d17bcb51fc9cd97ea5cf81aba27165576bd2ec317a5428ec38da4ae",
"Created": "2020-05-02T07:10:32.712912509+08:00",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.17.0.0/16",
"Gateway": "172.17.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"cf536f1630dbc66579a300127d62e3f116ae107497e4280ca38032cf207d4b05": {
"Name": "brave_zhukovsky",
"EndpointID": "da34c73ccada76bad5367a6e0678072b19ad4a398fc2fe3a551e8505a7ed1d9e",
"MacAddress": "02:42:ac:11:00:02",
"IPv4Address": "172.17.0.2/16",
"IPv6Address": ""
}
},
"Options": {
"com.docker.network.bridge.default_bridge": "true",
"com.docker.network.bridge.enable_icc": "true",
"com.docker.network.bridge.enable_ip_masquerade": "true",
"com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
"com.docker.network.bridge.name": "docker0",
"com.docker.network.driver.mtu": "1500"
},
"Labels": {}
}
]
containers
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fabeb939d2fb cariaga/dock "docker-entrypoint.s…" 23 seconds ago Up 21 seconds 8080/tcp, 0.0.0.0:8081->8081/tcp naughty_bassi
[SOLVED]
So the problem was i need to access the 192.168… ip NOT the 172.17.0 part which can only be accessed within the same machine while the 192.168. part can be accessed within the local network.
http://192.168.1.124 :8081