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
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:
Could you please help me how to install a local standalone pulsar cluster using windows docker.i have followed the below options.but i couldn't able to access the pulsar UI
8080 port is already allocated for some other process.so here i'm using 8081 port.
Option 1:
docker run -it -p 6650:6650 -p 8081:8081 --mount source=pulsardata,target=/pulsar/data --mount source=pulsarconf,target=/pulsar/conf apachepulsar/pulsar:2.5.2 bin/pulsar standalone
Option 2:
docker run -it -p 6650:6650 -p 8081:8081 -v "$PWD/data:/pulsar/data".ToLower() apachepulsar/pulsar:2.5.2 bin/pulsar standalone
Using the above two options, i couldn't able to see the INFO - [main:WebService] - Web Service started at http://127.0.0.1:8081.Also i'm not able to access the following url in the system.
pulsar://localhost:6650
http://localhost:8081
Thanks
The problem is the mapping between the ports. It is clear that you cannot use 8080 on your side, but the port 8080 should be still used within the container, because this port is used by the service. The correct command is:
docker run -it -p 6650:6650 -p 8081:8080 apachepulsar/pulsar:2.5.2 bin/pulsar standalone
It makes sense to try it out without the volumes first and add them later.
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
I set up a one-click docker server on DigitalOcean, then ssh'd into it as root#[Server IP] and ran the following
docker pull continuumio/memex-explorer
docker run -p 80:5000 continuumio/memex-explorer
Which outputs:
* Starting OpenBSD Secure Shell server sshd
...done.
* Running on http://0.0.0.0:5000/
* Restarting with reloader
Then when I navigate to [Server IP]:5000 it doesn't display anything. I expected it to present the landing page of the app.
I then ran
ufw allow 5000/tcp
ufw allow 80/tcp
ufw enable
but it didn't help.
Can anyone install and set up this app? There's a link to the source of the app I'm trying to run: Here, and the docker image: Here
It looks like you just needed to run it in detached mode.
I just provisioned a droplet on Digital Ocean and spun up the Docker image with this run command:
sudo docker run -d -p 80:5000 --name memex continuumio/memex_explorer
There is no need to change any firewall settings.
Make sure the container is active:
sudo docker ps
It should display something like this:
64242f576c16 continuumio/memex_explorer:latest "/root/memex-explore 35 minutes ago Up 35 minutes 22/tcp, 80/tcp, 0.0.0.0:80->5000/tcp memex
To see the application running, just type the Digital Ocean [Server IP] into the URL for the browser. The port is redirected to port 80 so no need to type it in.
You can attach to the container and look around (the Dockerfile is available in the image as well).
sudo docker exec memex bash
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.