Skip to content
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

Allow to run through docker #466

Merged
merged 1 commit into from
Jul 29, 2024
Merged

Allow to run through docker #466

merged 1 commit into from
Jul 29, 2024

Conversation

felipecrs
Copy link
Contributor

No description provided.

@felipecrs
Copy link
Contributor Author

felipecrs commented May 8, 2023

For testing this before merging:

$ docker build --tag nut https://github.com/felipecrs/nut.git
$ docker run --rm -it --network=host --env=DISPLAY --volume=/tmp/.X11-unix:/tmp/.X11-unix --volume="$PWD:$PWD" --workdir="$PWD" --user=$(id -u):$(id -g) nut

@felipecrs
Copy link
Contributor Author

@andrea-ap, replying to your comment here:

I just tried the two commands above and it worked just fine. Here is a quick demo:

WindowsTerminal_pM5gcOy0wI.mp4

Since you mentioned you are running with Docker Desktop, my recommendation is that you run this command through WSL2 and not through PowerShell/CMD for example.

@andrea-ap
Copy link

andrea-ap commented Jun 11, 2023

@andrea-ap, replying to your comment here:

I just tried the two commands above and it worked just fine. Here is a quick demo:

WindowsTerminal_pM5gcOy0wI.mp4
Since you mentioned you are running with Docker Desktop, my recommendation is that you run this command through WSL2 and not through PowerShell/CMD for example.


Hi, thank you for your quick reply. I have downloaded the code from the repository, I have already inserted the titledb folder, and inserted the key. I use winn1 and i installed ubuntu as subsystem of win11.I created image with: docker build -t nut . , and then I ran the command line: docker run --rm -it --network=host --env=DISPLAY --volume=/tmp/.X11-unix:/tmp/.X11-unix --volume= "$PWD:$PWD" --workdir="$PWD" --user=$(id -u):$(id -g) nut , the problem is that I don't reach my pc locally, using ip which tells me the nut server, but how can I proceed, do I have to change ip in the ubuntu instance as a win11 subnet, or do I have to create network in ducker?And not see connect usb? Thank you.

nut-video.1.mp4

@felipecrs
Copy link
Contributor Author

Oh... I got your problem now. And I honestly don't know how you can overcome it.

@andrea-ap
Copy link

i solve with: sudo docker run --rm -it --network host --env=DISPLAY --volume=/tmp/.X11-unix:/tmp/.X11-unix --volume="$PWD:$PWD" --workdir="$PWD" --user=$(id -u):$(id -g) nut-server-mod:latest

@felipecrs
Copy link
Contributor Author

felipecrs commented Jun 25, 2023

What did you change exactly? Added sudo and removed the user?

@andrea-ap
Copy link

i wasn't reachable from outside, i changed --network=host to --network host , so i fixed it

@andrea-ap
Copy link

The --network host option is used to make programs inside the Docker container appear to be running on the host itself, from a network perspective³. This allows the container to have more network access than it can normally get.

Note that the host network driver only works on Linux hosts and is not supported on Docker Desktop for Mac, Docker Desktop for Windows, or Docker EE for Windows Server.

The --network option is used to specify the network to which the container should be connected during startup. Docker supports several network drivers, including bridge, host, overlay, ipvlan and macvlan. Each network driver has its own options and features.

@felipecrs
Copy link
Contributor Author

That's funny. --network=host is the same as --network host, but glad it worked for you.

@pkobielak
Copy link

This looks nice, installation is actually a bit of a hassle, why isn't it merged?

@blawar blawar merged commit 8a14810 into blawar:master Jul 29, 2024
@blawar
Copy link
Owner

blawar commented Jul 29, 2024

This looks nice, installation is actually a bit of a hassle, why isn't it merged?

merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants