-
-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add possibility to forward custom ports #32
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is really useful!
I think we should remove the hardcoded SSH forwarding in favour of this method so users that want SSH can enable it manually.
Also could you add a small note to the readme documenting this feature?
Thanks for the review! I've done as you suggested. |
This is great, thanks @matteocarnelos , saves many rebuilds, however in using , can I suggest for being explicit and clear , renaming |
That makes sense, I'll rename the variable to To open multiple ports is necessary to put the entries separated by spaces. So, in your example:
services:
dockerpi:
image: lukechilds/dockerpi
ports:
- "5678:5678"
- "22:22"
environment:
- QEMU_HOSTFWD=tcp::5678-:5678 tcp::22-:22 |
thanks @matteocarnelos , could you add that multiple port explanation to the readme, it super useful |
@auphofBSF done👍 |
@matteocarnelos I've been trying to get this working by cloning your repo and building the docker image from there. The build works fine and I can get Docker going, however the ssh service isn't starting during boot. When I login with pi/raspberry and run When I then try to start it up without Not sure what I'm missing here. I've got some technical background from long ago... but not much to do with networking, SSH or Linux services. So not sure how to proceed to debug / help. I'm at your disposal, if you want to send me some things to try. Things for reference in case they're useful. First, the Docker commandline I used to run the container. I'm not interested in MQTT, just SSH.
I also tried this, the only difference is that I removed the IP address from the QEMU_HOSTFWD argument:
Here's my terminal contents where I started the service and checked its status. I split it into blocks to make it easier to read.
|
Er, nevermind. I just had to start sshd, and figure out how to use SSH. |
Will this be merged anytime soon? |
@lukechilds do you plan on merging this? |
Since @lukechilds doesn't seem to be maintaining this repo anymore, if you need this feature, you can use my custom-built image. |
Great thanks. Will you publish under a different container name ie? |
Don't think so, at least for now. |
@matteocarnelos Any clue why whatever I try to connect via ssh I get this error? I tried both using the main image and yours using custom forwarding, no way P.S: curious to see we are 'neighbors' and we attended the same university :) Update: Seems the reason is ssh is not enabled by default, need to enable the service using |
@robertsLando I can confirm that's the problem. In my custom image it would be ok to have SSH disabled by default since the SSH port is not forwarded by default and you might not need it. However, in the original image you want it enabled since the SSH port is forwarded by default and thus SSH must be available. PS: È proprio piccolo il mondo! 😉 |
Important
Since the maintainer of this repository is no longer actively maintaining it, I'm hosting a custom-built image with this feature added at
ghcr.io/matteocarnelos/dockerpi
.If you wish to use this feature before it gets merged (if it will ever get merged at all), replace all instances of
lukechilds/dockerpi
withghcr.io/matteocarnelos/dockerpi
.I've added the possibility to forward custom ports (besides the SSH one) by setting the environment variable
HOSTFWD
.This is particularly useful when using applications with a web interface (Grafana, InfluxDB, RaspAP,...) inside the emulated Raspberry Pi, or when using protocols such as MQTT, FTP,....
Usage
Add one or more entries in the standard QEMU format (
protocol::hostip:hostport-guestip:guestport
) separated by spaces.Example using the
docker run
command to expose the MQTT port from the Raspberry Pi to the Container (-e
part) and from the Container to the Host (-p
part):Example using the
docker-compose.yml
file to achieve the same as above: