I am following this tutorial on using docker images, and I am at the stage to run the example docker image like follows:
docker run -p 4000:80 friendlyhello
On the command line it seems ok:
>docker run -p 4000:80 friendlyhello
* Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
but when I try to open the page http://localhost:4000 on a web browser, it seems to be unable to connect (Safari and Firefox). On Firefox the error message is
Unable to connect
Firefox can't establish a connection to the server at localhost:4000.
The site could be temporarily unavailable or too busy. Try again in a few moments.
If you are unable to load any pages, check your computer's network connection.
If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.
I also checked the file /etc/hosts and it contains the following entry
127.0.0.1 localhost
So what could be the problem?
I found this solution and tried the following command:
docker run -p 127.0.0.1:4000:80 friendlyhello
which still leads to the same problem. I also tried to open
`http://localhost:80`
again without success.
Related
I'm trying to get an SFTP connection working in PhpStorm. It works fine in FileZilla.
In the SSH config section of the STFP config, I enter host, username and auth type (password) and click Test Connection. It connects fine.
If I click OK and go dialog level back and click Test Connection on the main SFTP config, I get Connection to dev.the-server.net failed. EOF while reading packet error. Like wise when I close the SFTP config dialog, there is an EOF while reading packet error where a directory listing should be.
If I use the same credentials and connect by FTPS, I can get a remote directory listing and download files, but I get the end of file error trying to upload.
This all seems to be PhpStorm issue because I can upload and download fine with FileZilla. For workflow reasons, I really need PhpStorm to connect.
Any thoughts on where to start?
Images of the SFTP dialog:
Main SFTP config
SSH section of SFTP config
Restarting PhpStorm helped to solve the problem.
For me, it failed because sftp-server was configured with the wrong path in sshd_config, and this link saved me. so:
Find the correct path of sftp-server (the whereis sftp-server command may be help), e.g. /usr/libexec/sftp-server.
Set the correct path in sshd_config (most likely in /etc/ssh/sshd_config), e.g. Subsystem sftp /usr/libexec/sftp-server.
Restart the sshd server (possibly /etc/init.d/sshd restart or /usr/sbin/sshd restart).
Restart your IDE.
In my case I've changed SSH settings, restarted SSH service, restarted PHPStorm but it didn't help. But when I restarted the whole server and then tried again it started to working again.
In my case I didn't install openssh in server. You can try this command.
sudo apt-get install openssh-server
sudo systemctl enable ssh
sudo systemctl start ssh
I was trying to running a docker image from a gitlap repository as mentioned in https://codebabel.com/ci-gitlabci-docker/
I ran the image as shown below and it started
docker run -p 5000:50000 -it registry.gitlab.com/bacdef/flaskapp:latest
* Serving Flask app "helloworld" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: on
* Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!
* Debugger PIN: 259-006-586
But when I try to access it via browser http://127.0.0.1:5000/ or http://localhost:5000/ or http://myip:5000/ it reply as follows
This page isn’t working 127.0.0.1 didn’t send any data.
ERR_EMPTY_RESPONSE
docker ps command output ias as follows
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
04cc5dc26ec5 registry.gitlab.com/bacdef/flaskapp:latest "python helloworld.py" 18 minutes ago Up 18 minutes 0.0.0.0:5000->50000/tcp hardcore_perlman
I am running it on a mac os.
Tried solution of similar questions like How to access webserver running in docker container from browser?, https://superuser.com/questions/1204030/cannot-access-to-http-localhost4000-after-i-map-this-port-number-to-docker but it does not work.
Can somebody please suggest what am I doing wrong?
I'm new using Docker. I have been trying to deploy a Linux container (with Windows as a host) with a Google Cloud image inside using Docker. I'm able to do everything well, at the end the server is running perfectly, but when I want to check the server, using the localhost in the browser, I got a blank page with:
Blank page
This is the Dockerfile:
FROM google/cloud-sdk
ENV PATH /usr/lib/google-cloud-sdk/bin:$PATH
WORKDIR docker_folder
COPY local_folder/ .
RUN pwd
EXPOSE 8080
CMD ["java_dev_appserver.sh", "."]
This is the command I'm using to build my image (in the CMD):
docker build --tag serverdeploy .
This is the command I'm using to run my container
docker run -p 8080:8080 serverdeploy
This is the stack trace that I got when I run the server
where I know that I running the server
I did some research and looks like Docker had a problem with the ports when you use a Linux container in Windows (Not sure if it's already solved or not). I've already tried all the possible solutions that I found out there (even trying to replace 'localhost' by all the ip's that I get when I run ipconfig on the cmd) but I still get the same error.
And, as last hope, I need your help to understand what I'm doing wrong, or if I missing something
You are running your service bind to localhost - that means no remote connections are accepted (as well as binding to 127.0.0.1. And for your container the host is a remote connection.
Change binding to 0.0.0.0 (which I guess is default) and enjoy.
Btw sharing your java_dev_appserver.sh would be helpful for answering the question.
Recently started to use Docker in Windows because that's the enviroument where I work. I don't have any problem connecting WSL with Windows Docker an using it for first instance.
After reboot my laptop the problems cames to me. When I'm trying to create an image I get the next error:
docker: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).
Is so weird beacause if uninstall windows docker and reinstall it, everything works but if reboot or shut down my laptop, the problem comes again.
It seems like DNS resolve issues about Docker registry.
Sometimes DNS on DHCP information or your network settings makes this trouble on windows.
Try to change DNS options from Automatic to Fixed GoogleDNS(8.8.8.8) on Docker for Windows settings.
Please refer this screenshot.
Fixed DNS Settings on Docker for windows
I have some Selenium Webdriver/Capybara automation setup in a ruby app. Along with this in a VirtualBox VM using Linux I have a docker container for Selenium grid docker run -d -p 4444:4444 --name selenium-hub -e GRID_TIMEOUT=120000 selenium/hub:2.53.0 and a firefox node docker run -d --link selenium-hub:hub selenium/node-firefox:2.53.0. After adding a DNS entry to docker_opts on the VM, in my host machine if I run my Selenium test (which uses the grid on my VM) everything works fine.
After this I setup my automation code in a ruby container on my vm along side the grid and containers. The container builds just fine. I am also able to attach to it without issue and all my code is there as expected. from the terminal in my automation container if attempt to run a spec ex. rspec spec/some_spec.rb I will get a connection refused error
"Failed to open TCP connection to 127.0.0.1:4444 (Connection refused - connect(2) for \"127.0.0.1\" port 4444)"
of the 18 results googling up this issue the only thing I saw that seemed actionable mentioned creating a bridge, which I don't really understand. Any suggestions on how to correct this would be greatly appreciated.
It's not easy to say without seeing your specs but I'm guessing you connect to selenium on 127.0.0.1:4444 in your tests?
If so you should now connect to it on hub:4444 as that is the name which will resolve to the IP of your selenium hub container.