I started a docker image using
docker run --interactive --tty node_web_1
And the running server inside the container successfully prints
Running on http://localhost:8080
in the console. I have exposed port 8080 in the Dockerfile. So in my understanding, when I call http://localhost:8080 in the browser in windows, I should access the server in the container, right? I get no reply though....
How do I go about finding the error? I executed the command
docker-machine ls
as suggested here How to access Docker container's web server from host but apparently I have no docker-machines running? What are those machines? Do I need them? I have only docker for windows installed, no additionall packages or shells.
try to publish your port
docker run -p 8080:8080 -it node_web_1
Related
I want to ping a website from inside my docker container through tor proxy on my local machine. Without setting the proxy, I could not be able to ping. When I run my container with:
sudo docker run --rm -it -p9150:9150 my-container
I got the following error:
Error starting userland proxy: listen tcp 0.0.0.0:9150: bind: address already in use.
I started tor-browser on my localhost:9150 but I can't do port-forwarding when running a container. Also I don't want to use --net=host in command. I added the following line
Environment="ALL_PROXY=socks5://127.0.0.1:9150" to /lib/systemd/system/docker.service but it didn't word. Anyone can help me with this? (OS: Ubuntu 20.04)
To run the TOR proxy and the app
After a long research I did, I came up to the following steps:
sudo docker pull dperson/torproxy
sudo docker network create tor
sudo docker run --rm -it --name mytor --network tor -p9050:9050 dperson/torproxy
sudo docker run --rm -it --network tor myapp
Inside myapp I have a python script which sends message to my telegram channel through tor socks proxy. I have a network (tor) and both containers see each other through it. In the python script I have the following line:
bot = telegram.Bot(token=token, request=Request(con_pool_size=10, connect_timeout=40, proxy_url='socks5h://mytor:9050'))
To manually test the TOR proxy
Run another container, a general-purpose one like for example
docker run --rm -it --network tor ubuntu:22.04
Install curl the usual way (for example with apt-getin debian/ubuntu).
Then inside the command line do:
curl -x socks5://mytor:9050 http://checkip.amazonaws.com/
You'll see the IP of the TOR exit node:
I am trying to install and run splash on using Windows 10 Home. I have installed docker toolbox, as on windows 10 Home you can't install docker. Then in command prompt when I type
docker pull scrapinghub/splash
I get the error
error during connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.40/images/create?fromImage=scrapinghub%2Fsplash&tag=latest: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
One interesting thing I noticed was that if I run Docker Quickstart Terminal I can install splash with the command
docker pull scrapinghub/splash
and then using the command
docker run -p 5023:5023 -p 8050:8050 -p 8051:8051 scrapinghub/splash
it gives me
server listening on http://0.0.0.0:8050
But then when I paste http://0.0.0.0:8050 into Chrome it gives me "This site can't be reached."
Thanks
So 1st error clearly says that your Docker container is not running, so your pull command fails
You can check by running any docker command maybe try this
docker --version
For your 2nd query, you need to use Docker IP, to access the application
You can try docker-machine ip to see, on what IP docker is running (Assuming docker-machine is installed)
Generally, on windows Docker IP is 192.168.99.100
Try these 2
192.168.99.100:8050
or
localhost:8050
Docker Image: has apache; has an HTML file in the apache root.
How can I access that file form the browser? (when I run the image)
I tried:
docker run -d -p 8080:80 myimage/myimage
but when I do docker ps I see the port as 0.0.0.0:8080->80/tcp but I get HTTP ERROR 500 when opening 0.0.0.0:8080 or localhost:8080.
Login in to docker container
docker exec -it container_id /bin/bash
and start apache server if its not started.
service apache2 restart
Then from browser access using : http://localhost:8080
I have an Eclipse instance running on linux Ubuntu in a docker container. This container runs on a CentOS host with no physical display and I would like to forward X11 from the docker container to my laptop (running windows) through the CentOS host.
Docker container runs with
docker run --name docker-eclipse -p 5000:5000/tcp -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix
While I can forward X11 from the host to my laptp with no problems, I'm not able to start eclipse inside the container, because it dies with "Cannot open display:".
What I'd like is
laptop --> remote host --> docker container running eclipse
What is the best way to do that?
This might work (server is assumed to be the remote host running Docker, laptop is assumed to be the local host from which you want the GUI):
Connect to the server.
Mount through sshfs the laptop's .X11 socket from the server: user#server:$sshfs laptop:/tmp/.X11-unix /tmp/.X11-unix.
Start the container with something like user#laptop:ssh -X server docker run --name docker-eclipse -p 5000:5000/tcp -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix.
I'm not sure this would work, and it does not feel the cleanest way of doing so, but what you want to perform is quite.... unusual (though it would be something really great !!).
Comment your feedback !
I am completely stuck on the following.
Trying to setup a express app in docker on an Azure VM.
1) VM is all good after using docker-machine create -driver azure ...
2) Build image all good after:
//Dockerfile
FROM iojs:onbuild
ADD package.json package.json
ADD src src
RUN npm install
EXPOSE 8080
CMD ["node", "src/server.js"]
Here's where I'm stuck:
I have tried all of the following plus many more:
• docker run -P (Then adding end points in azure)
• docker run -p 80:8080
• docker run -p 80:2756 (2756, the port created during docker-machine create)
• docker run -p 8080:80
If someone could explain azure's setup with VIP vs internal vs docker expose.
So at the end of all this, every port that I try to hit with Azure's:
AzureVirtualIP:ALL_THE_PORT
I just always get back a ERR_CONNECTION_REFUSED
For sure the express app is running because I get the console log info.
Any ideas?
Thanks
Starting from the outside and working your way in, debugging:
Outside Azure
<start your container on the Azure VM, then>
$ curl $yourhost:80
On the VM
$ docker run -p 80:8080 -d laslo
882a5e774d7004183ab264237aa5e217972ace19ac2d8dd9e9d02a94b221f236
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
64f4d98b9c75 laslo:latest node src/server.js 5 seconds ago up 5 seconds 0.0.0.0:80->8080 something_funny
$ curl localhost:80
That 0.0.0.0:80->8080 shows you that your port forwarding is in effect. If you run other containers, don't have the right privileges or have other networking problems, Docker might give you a container without forwarding the ports.
If this works but the first test didn't, then you didn't open the ports to your VM correctly. It could be that you need to set up the Azure endpoint, or that you've got a firewall running on the VM.
In the container
$ docker run -p 80:8080 --name=test -d laslo
882a5e774d7004183ab264237aa5e217972ace19ac2d8dd9e9d02a94b221f236
$ docker exec it test bash
# curl localhost:8080
In this last one, we get inside the container itself. Curl might not be installed, so maybe you have to apt-get install curl first.
If this doesn't work, then your Express server isn't listening on port 80, and you need to check the setup.