Recently I have been working a lot with docker, especially docker-compose.
Oftentimes I have some container running along with a database and sometimes I want to inspect the data of the database with some external tool on my machine.
The database itself is only available to the other containers so it isn't directly exposed and I cannot connect to it from my machine.
In order for this to work I would have to shut it down, expose the port and start it again.
As this is not an ideal solution for me I would like to know if there is a way to temporarily expose a container's port or spin up some kind of proxy without the need to do a lot of manual configuration?
Ideal solution would be something like this:
docker run -p 1234:80 -e PROXY_TO=1.2.3.4:8080 proxyimage
This sample command would then expose the created container on port 1234 and proxy all incoming traffic to port 8080 of the container running on ip 1.2.3.4
.
Then I could just open up my database application, connect to port 1234 and would get the data of 1.2.3.4:8080
that would normally be hidden for me.
Is there anything like this or another solution for this problem?
I know that depending on the database used I could just spin up some web based tool (like phpmyadmin) or create my own admin UI but this would take quite some time.