How to intercept Docker's container traffic with Burp? - docker

I did the following:
Run docker pull bkimminich/juice-shop
Run docker run --rm -p 3000:3000 bkimminich/juice-shop
Browse to http://localhost:3000 with Burp listening to 127.0.0.1:8080 => I see external traffic (google, cdn...) but not internal (Docker container).
So please how to configure my container to connect it with my proxy Burp. Burp is installed on Windows not inside the container. Thks

While running Docker Pull, did you try to run it with 8080 port.
If the problem is not resolved, try to open port 3000 from Burp Suite / Proxy / Settings.
If there is a certificate setting in the Docker container, I suggest you check it.

Related

What is i run docker run jenkins/jenkins?

My question is like what if i run
docker run jenkins/jenkins
without specifying port details then will it run and if it run then on which port it will run? on default?
The Jenkins container will start and will be accessible within the Docker environment. (Container to Container communication) But you will not be able to access it via the Host machine. If you want to access the container from the host machine you have to bind the Jenkins port 8080 of the container to TCP port X of the host machine. You can use -p 8080:8080 option for this.

I can't access my Docker container on GCP Compute Engine

I have my Docker container running on GCP Compute Engine. The CE server is running on CentOS 7. My Docker container has the application being served by Nginx with port 80 exposed. For some reason, I can't access it from the external IP address on my browser.
I ran the container with this command:
sudo docker run --name myapp -p 80:80 -d myapp:1.0.0
When I do sudo curl <internal_ip>:80 or sudo curl <localhost>:80 it will show that the application is running and returns back the content, but if I try to access in my browser with <external_ip>:80, it doesn't load anything. What can I do to make this accessible through the external IP address?
It seems I had to configure the firewall to open up port 80.

How to restrict that a docker container only listens connection from localhost?

I am running a docker container by docker run -p 8080:8080. Other computers can visit my server by visiting [my ip]:8080. However, for security reasons, I want only localhost(127.0.0.0) is able to access to my server. I do not want other people to connect to my server. How do I restrict that a docker container only listens the host 127.0.0.1?
You can use:
docker run -p 127.0.0.1:8080:8080 your_image_name
This will map the container's port 8080 to only listen on host's 127.0.0.1 at port 8080.

Container should communicate to host network, but does not

I have a two HTTP servers on my host machine; one listening on 8080, the other listening on 8081. The 8080 is a webapp, and the 8081 is an API.
I also have a Docker container that should connect to the webapp on 8080 using an automated tool, and that webapp should make HTTP requests to the API that's on 8081.
Here is a visual representation of what I want:
Host machine HTTP 8080
⇩ ⇖
⇧ Docker container
Host machine HTTP 8081
The problem I'm having is that the Docker container cannot connect to the website on the host machines 8080. I'm not sure why, because I set the --network=host flag, so shouldn't it be using the host machines network?
This is my Docker image:
## Redacted irrelevant stuff...
EXPOSE 8080 8081
This is how run the container:
docker run -d -p 8080:8080 -p 8081:8081 --network=host --name=app app
Any ideas what's wrong with my setup?
So you have two services running directly on the machine and you want to deploy a Docker container that should connect to one of those services.
In that case, you shouldn't map those port to the container and you shouldn't expose those ports in the Dockerfile as those ports are not for the container.
Remove the Expose ports from the Dockerfile
Start the container using docker run -d --network=host --name=app app. The container should be able to access the services using localhost:8080.

Run docker but get This site can’t be reached 192.168.99.100 refused to connect

I unable to access docker exposed port on windows machine. In details I do the following:
$ docker build -t abc01 .
$ docker run -d -p 80:4000 abc01
Then I try to reach docker container in browser:
http://192.168.99.100:4000
and get annoying result:
This site can’t be reached 192.168.99.100 refused to connect.
What is the issue?
You are exposing the right ports, however, you need to access the website at: 80 instead of 4000, given that 4000 is the port on which your application is listening.
The way exposing ports in Docker works is as follows:
docker run -p 80:4000 myImage
where
80[is the outside port]
The one is exposed on your host and you will use it in your browser
4000 [is the inside port]
The port that is used inside the container by the application

Resources