Dockport is a lighweight, automatic proxy for docker containers.
- Create a network for Dockport:
docker network create Dockport
- Run the proxy using:
docker run -d --name Dockport -v Dockport:/Dockport/data -e PROXY_DOMAIN=localhost --network Dockport -p 80:80 -p 2222:22 ghcr.io/cyberl1/dockport
- Run another container connected to the proxy network:
docker run -d --name another-container --network Dockport nginx:alpine
- Go to http://another-container.localhost in your browser and see the result. If your container is listening on diffrent port (i.e 8080), then go to http://another-container-8080.localhost
- Run another container connected to the proxy network:
docker run -d --name another-container --network Dockport alpine /bin/sh -c 'apk update && apk add openssh && adduser user --gecos "" --disabled-password && echo "user:password" | chpasswd && ssh-keygen -A && /usr/sbin/sshd -D'
- Connect to it using:
ssh -J localhost:2222 user@another-container