I am following google cloud machine learning tutorial and I am unable to Launch TensorBoard
I've followed the steps in the above tutorial (also set up my environment using docker container) until typing the below command in the terminal
tensorboard --logdir=data/ --port=8080
Where the terminal outputs the below prompt
Starting TensorBoard 29 on port 8080
(You can navigate to http://172.17.0.2:8080)
When I visit http://172.17.0.2:8080 in my browser I see nothing (the server where this page is located is not responding).
Can someone please advice how I can launch Tensor Board ?
Had the same problem this morning. Solved it with
tensorboard --logdir=data/ --host localhost --port 8088
Navigated the browser to http://localhost:8088
Try
tensorboard --logdir=d:/data --host 0.0.0.0
This will open socket listening to all network interfaces, so you can connect from local host (same pc) or from the local network(from pc/mobile in network).
I faced the same problem when used Tensorboard inside a Docker container. The successful steps in my case were:
First of all, make sure the port you use for Tensorboard is opened to the outside world. To make this possible run your Docker container with an option -p <host_machine_port>:<tensorboard_port_inside_container>. For example:
docker run --name my_tensorboard_container -p 7777:8080 my_tensorboard_image bash
Then if you still cannot access the Tensorboard try to add --bind_all option like so:
tensorboard --bind_all --port 8080 --logdir ./logs
Hope, it works in your case as well.
It looks like the port 8080 is not open on your machine.
You can check it with this command line tool: netstat -a.
To open a specific port on google cloud platform, see this answer from SO.
If you are using Google Cloud Shell you have to click on icon placed in upper left of shell window.
There are 2 solutions(as far as i could check) to solve this problem:
Instead of using the http://name:port_number, use
http://localhost:port_number.
This is if you are using Chrome browser.
If you are using firefox(recommended as it's really convenient), then you can open the link(which has your PC name) directly, which is displayed after executing the "tensorboard --logdir=logs/" command in cmd, i.e; http://name:port_number will work here.
(name here refers to the PC or user name)
I don't know if that's the case, but tensorboard has some visualization problems in several browsers. Try to connect to http://172.17.0.2:8080 with a different browser (for example, on my macbook, safari doesn't work very well with tensorboard and I use google Chrome).
as stated by 'rodrigo-silveira'
tensorboard --logdir=data/ --host localhost --port 8088
this works for me as well.
just change the name of graph directory. here the directory is data/
writer = tf.summary.FileWriter( 'logs', sess.graph )
here, the directory is logs, so when I typed below command in cmd, below window appeared.
tensorboard --logdir=data/ --host localhost --port 8088
this is the window pop up
you have to change port to the tensorboard port in the right toolbar in Gloud shell
In my case, the port was not open.
Opening the port, helped me. This process was done on Linux.
Here is what I did:
First I checked if the port is open or not.
netstat -tulpn
You can check it by above code.
Then open the port by following code. Just change the port number in place of 8080
sudo /sbin/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
sudo iptables-save
This should solve the issue.
Related
I'm trying to simulate gps data inside a docker container using gpsfake, but fail since all ports seem to be closed.
The docker container is based on the ubuntu:16.04 image and inside it I've run apt-get install gpsd gpsd-clients.
Then I try to simulate gps data from a file with
gpsfake -P 3001 file.nmea
but get the error
gpsd:ERROR: can't bind to IPv6 port 3001, Cannot assign requested address
Trying other ports doesn't seem to work. Upon running nmap -sTU -O localhost I get back that All 2000 scanned ports on localhost (127.0.0.1) are closed. I tried explicitly opening a port with ufw allow <port> but without luck, nmap -P <port> returns STATE=closed.
Should I expect ports to be closed? I must be missing something.
I've tried the same. Apparently, the issue is due to the fact that gpsd responds by default only on the localhost. In fact, if you try to connect from within the container (e.g. with gpspipe) you see that gpsd in container is working correctly.
Indeed, gpsd has a flag (-G) to modify this behaviour, but to my knowledge there isn't any option of gpsfake to instruct the latter to launch gpsd with such flag.
I am using VS2017 docker support. VS created DockerFile for me and when I build docker-compose file, it creates the container and runs the app on 172.x.x.x IP address. But I want to run my application on localhost.
I did many things but nothing worked. Followed the docker docs as a starter and building microsoft sample app . The second link is working perfectly but I get HTTP Error 404 when tried the first link approach.
Any help is appreciated.
Most likely a different application already runs at port 80. You'll have to forward your web site to a different port, eg:
docker run -d -p 5000:80 --name myapp myasp
And point your browser to http://localhost:5000.
When you start a container you specify which inner ports will be exposed as ports on the host through the -p option. -p 80:80 exposes the inner port 80 used by web sites to the host's port 80.
Docker won't complain though if another application already listens at port 80, like IIS, another web application or any tool with a web interface that runs on 80 by default.
The solution is to:
Make sure nothing else runs on port 80 or
Forward to a different port.
Forwarding to a different port is a lot easier.
To ensure that you can connect to a port, use the telnet command, eg :
telnet localhost 5000
If you get a blank window immediatelly, it means a server is up and running on this port. If you get a message and timeout after a while, it means nobody is running. You anc use this both to check for free ports and ensure you can connect to your container web app.
PS I run into this just a week ago, as I was trying to set up a SQL Server container for tests. I run 1 default and 2 named instances already, and docker didn't complain at all when I tried to create the container. Took me a while to realize what was wrong.
In order to access the example posted on Docker Docs, that you pointed out as not working, follow the below steps,
1 - List all the running docker containers
docker ps -a
After you run this command you should be able to view all your docker containers that are currently running and you should see a container with the name webserver listed there, if you have followed the docker docs example correctly.
2 - Get the IP address where your webserver container is running. To do that run the following command.
docker inspect -f "{{ .NetworkSettings.Networks.nat.IPAddress }}" webserver
You should now get the IP address which the webserver container is running, hope you are familiar with this step as it was even available within the building Microsoft sample app example that you attached with the question.
Access the IP address you get once running the above command and you should see the desired output.
Answering to your first question (accessing docker container with localhost in docker for windows), in Windows host you cannot access the container with localhost due to a limitation in the default NAT network stack. A more detailed explanation for this issue can be obtained by visiting this link. Seems like the docker documentation is not yet updated but this issue only exists in Windows hosts.
There is an issue reported for this as well - Follow this link to see that.
Hope this helps you out.
EDIT
The solution for this issue seems to be coming in a future Windows release. Yet that release comes out this limitation is available in Windows host. Follow this link -> https://github.com/MicrosoftDocs/Virtualization-Documentation/issues/181
For those who encountering this issue in 2022, changing localhost to 127.0.0.1 solved an issue for me.
There is other problem too
You must have correct order with parameters
This is WRONG
docker run container:latest -p 5001:80
This sequence start container but parameter -p is ignore, therefore container have no ports mapping
This is good
docker run -p 5001:80 container:latest
I run the images in docker terminal:
docker run -p 4000:80 friendlyhello
Localhost does not connect and display images.
This site can’t be reached
localhost refused to connect.
- Did you mean http://localhost4000.org/?
- Search Google for localhost 4000
ERR_CONNECTION_REFUSED
i think maybe you visit http://localhost:4000 in browser on Windows,then you should use the docker default machine ip(generally 192.168.99.100).
just try http://192.168.99.100:4000.
I had this problem too, solved following this part of the documentation:
Note: If you are using Docker Toolbox on Windows 7, use the Docker
Machine IP instead of localhost. For example,
http://192.168.99.100:4000/. To find the IP address, use the command
docker-machine ip.
If you running a nodejs app in the docker container, try '0.0.0.0' instead of 'localhost'.
example: suppose your app works on port 3000
server.listen(3000, 'localhost' () => {
console.log('listening for requests on port 3000');
});
server.listen(3000, '0.0.0.0' () => {
console.log('listening for requests on port 3000');
});
then you can do port-mapping in docker to your web app.
docker run -p 4000:3000 --name 'your_container_name' 'your_image_name'
start the container and see the port using the below command on your cmd or terminal.
docker port <your_container_name>
I also had this error using docker for windows.
Despite numerous attempts it wasnt resolved by playing with the port numbers and image rebuilds, or complete wipe of the docker container.
It took me a while to resolve so want to save you all some time.
1- enter the command Run docker network ls
Look for output similar to the below-
Network ID Name Driver Scope
cd6a217449e3 nat nat local
2- Copy the network ID
3-enter the command docker network inspect THENETWORKID
4- You will receive some outpuut to screen which looks like a json output, look for text similar to the below:-
"Containers": {
"4b953b6a597e38eac1de39119d30fb4c87bca6faae7da444b02e223685eed5c7": {
"Name": "jolly_rosalind",
"EndpointID": "5919da54af323505e18d9807742fd12bb3acbe260dcee28911ffdf56fb905baf",
"MacAddress": "00:15:5d:3c:50:58",
"IPv4Address": "172.30.49.218/16",
"IPv6Address": ""
}
5- enter 'http://THEIPV4ADDRESS:5000/' in your web browser, and you may be presnted with a beautiful '0'.
Good Luck!
With that docker run command, you should access to the container from your host using http://127.0.0.1:4000 as #Black said on comments. Anyway, your "friendlyhello" image what exactly is? because there are a lot of "friendlyhello" images on dockerhub, but yours is not any of them. There is no official friendlyhello image. Can you put your Dockerfile? Anyway, it is suppossed that a standard "friendlyhello" will run a web server on port 80 with a Hello World welcome page. It should work.
I already tested with docker run -p 4000:80 movila/friendlyhello and is working for me.
If is not working for you, it sounds like you have some kind of iptables problem. Reboot your machine in order to restore iptables rules (docker does it automatically) and try again.
Other possibility is to access directly to the container's ip instead of hosts ip. When you launch your docker container, if you don't specify -d parameter, it's going to get your terminal to print its log. On that log there is an ip. That ip is the container's ip. Example of my log:
* Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
172.17.0.1 - - [10/May/2017 07:13:53] "GET / HTTP/1.1" 200 -
172.17.0.1 - - [10/May/2017 07:13:53] "GET /favicon.ico HTTP/1.1" 404 -
You can try to use http://172.17.0.1 to access to it.
It will be good if you could share the Docker version and OS you are working on. Meanwhile, please try these steps:
Check if your container is actually running on port 80
Instead of using http://localhost:4000, try http://{CONTAINER_IP}:4000/ you should get your container IP by
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name_or_id
Maybe your app is on HTTPS. Try that as well
I resolved this situation on MacOS by installing and starting docker-machine
This is because a Virtual Machine is required to run docker on MacOS.
An alternative is to use Docker Desktop.
Even I was facing same problem and after implement the below solution where I replaced the "localhost" with docker ip address and it worked fine for me.
Just assigned the port and use below url
http://192.168.99.100:5050/ instead of http://localhost:5050
. Just replce your port number with "5050", it will work fine.
i think maybe you visit http://localhost:4000 in browser on Windows,then you should use the docker default machine ip(generally 192.168.99.100). just try http://192.168.99.100:4000.
I've just started experimenting with Docker and have hit an issue I haven't been able to resolve (please note, I'm using boot2docker).
My container has a simple service that listens on 8080/tcp and 5000/udp.
docker run -d -p 0.0.0.0:5000:5000/udp -p 0.0.0.0::8080 test/service
From my macos terminal, I can telnet to 192.168.59.103:8080 and issue simple commands, so TCP is working fine.
Next, I try UDP by issuing the following:
echo "HELLO" | socat - UDP-DATAGRAM:192.168.59.103:5000,broadcast
via Wireshark, I can see the datagram making it to the service and the service tries to echo it back, but receives an ICMP response stating the port is invalid.
So it seems I'm pretty close to having a working test case, but I'm just not sure what I need to configure to allow the broadcast back to the mac terminal that initiated the call.
Any advice would be appreciated.
I have two docker containers which runs on the same host(centos 6 server).
container 1 >> my web application (Ports mapped to some random port of host)
container 2 >> python selenium testscripts ( Runs headless Firefox)
My Test cases fails saying problem loading page
Basically the issue is that the second container or any other container residing on the same host is not able to access my Web application.
But my web app is accesible to outside world
I linked both containers and still i am facing the problem
I tried replicating the same setup in my laptop(ubuntu) and its working fine!!!
Any help appreciated !!
Thanks in advance
I think order matters in linking containers. You should start container1 the web application and then link container2 with webapp.
You need to change your selenium scripts to use the docker link id or alias as the hostname.
For example if you did:
$ sudo docker run -d --name webapp my/webapp
$ sudo docker run -d -P --name selenium --link webapp:webapp my/selenium
then your selenium scripts should point to http://webapp/
I had this problem in Fedora(22) - for some containers (not all). Upon inspection, it showed up there is an special DOCKER chain on the iptables, that can make some connections go loose. Appending an accept rule for that chain made things work:
sudo iptables -A DOCKER -p tcp -j ACCEPT
(While searching for the problem before hitting this question, there are suggestions this also occurs in CentOS and RHEL)
Yes the order of container launch does matter, But i am launching my web application container through jenkins.
jenkins is configured in container 2.
So i can not launch my web application(container 1) manually.
Is there anyother solution for this, something like bidirectional linkage??