npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

docker-port-forward

v1.0.2

Published

Tool to forward any port inside a container to host

Downloads

1

Readme

Docker Port Forward

Simple port forwarding of ports not exposed by a container

Build sidecar docker image Build example docker image

Installing the tool

NPM:
npm install -g docker-port-forward
Yarn:
yarn global add docker-port-forward

How do I run the tool

Its as easy as running this inside your terminal:
docker-port-forward <containerid/name> <containerport> <hostport(default:4000,optional)>

What does this tool do?

This tool allows you to setup a port forwarding for any port inside a docker container, even when it has not been exposed. docker-port-forward test-container 80 6060 will expose port 80 of the container on port 6060 where you run the tool.

How does the tool do this?

It connects first the container to a newly created network and starts a sidecar, this sidecar now has access to all the ports on the container. Once you connect to the portforwarded port it will use STDIO using the docker engine api to forward the traffic over the sidecar (which starts an socat process) to the target container.

Why do we need this?

Normally its not possible to gain access to a port on a running docker container without restarting it (but sometimes you dont want to), so this tool circumvents this. Alternative usecase is getting access to a containers port when you only have access to the docker engine api (this means also when the docker engine is running on another machine and you cant access any other port than the docker engine).

Test the tool

First start a container which listens on a port but does not expose (in this case were using an nginx server, image can be found in the example folder):
docker run --name pf-test ghcr.io/iammathew/docker-port-forward/example:latest

Now start the tool:
docker-port-forward pf-test 80 4000

You should see the following inside your terminal:

🔌 Connecting to pf-test...
🚀 Forwarding pf-test:80 to localhost:4000

When you visit now localhost:4000 with your webbrowser you should see a nginx start page :)