How to install USBIP in Docker Container - docker

I want to use USBIP in an Ubuntu 20.04 Docker Container. I tried installing the "linux-tools-generic" Package, but when i run USBIP afterwards i get the message:
You may need to install the following packages for this specific kernel:
linux-tools-5.10.16.3-microsoft-standard-WSL2
linux-cloud-tools-5.10.16.3-microsoft-standard-WSL2
You may also want to install one of the following packages to keep up to date:
linux-tools-standard-WSL2
linux-cloud-tools-standard-WSL2
How can i install these Packages ? Could'nt find them with apt-get.

Since Docker relies on the features of the Linux kernel, you'll need to make sure that you have the USB/IP module compiled into your WSL kernel. It is not there in the stock WSL kernel, so you'll need to build your own. I haven't done this with USB/IP myself, but there are reports from the Home Assistant (home automation) forums that indicate that it works.
See this answer for more details.

Related

Docker for Windows installed WSL2 without apt

I'm trying to work on a project, and the setup steps begin like this:
Clone the repo
Set up Docker
Run make
Being a Windows user, I installed Docker for Windows, and it installed WSL2 to get all the Linux stuff set up. But when I went to run make from the WSL shell, it couldn't find it. So I tried to get make from apt-get... and that wasn't there either!
It would appear that my WSL2 install is broken. Unfortunately, Googling for it hasn't turned up much of use. So how do I obtain apt for WSL so that I can build my toolchain?
Something similar happened to me: I installed Docker Desktop in Windows some months ago and it configured WSL to run behind it. However, it was WSL version 1 instead of version 2, and it did not install any Linux distro, since both apps run on top of WSL.
So please, go through the tutorial on the manual installation of WSL to check if all the steps are actually configured.
Before that, you can already check what version of WSL you have installed and its state, by running, in CMD or PowerShell:
wsl -l -v
After you set WSL v2 as your default version (Step 5 of the tutorial), you can make sure that Docker Desktop uses it. For that, check this link on the Docker Desktop WSL 2 backend, more specifically the Install section.
Regarding the make part of your setup, I believe that you can do that in a system of your preference. If you want to do that on WSL, I recommend you install Ubuntu running over your WSL (Step 6 of the tutorial).
Once you installed Ubuntu or other distro, you can run it as any other app. There, you can manage your apt, make and other installations right as in Linux :)

How to install linux-modules-extra?

When I run sudo apt install linux-modules-extra-$(uname -r) in a Docker container based on a Ubuntu 20.04 on a single board computer running Ubuntu 18.04, I get the following errors:
E: Unable to locate package linux-modules-extra-4.15.0-143-generic
E: Couldn't find any package by glob 'linux-modules-extra-4.15.0-143-generic'
E: Couldn't find any package by regex 'linux-modules-extra-4.15.0-143-generic'
To me, this makes me wonder whether it is even possible to install linux-modules-extra-4.15.0-143-generic in Ubuntu 20.04? Maybe it is only compatible with Ubuntu 18.04?
Could anyone clarify this for me please?
In general, if you're building a kernel module, it has to match exactly the kernel that's running on the host system. If you're using a native Debian or Ubuntu system (without Docker), there's a system where kernel modules can be rebuilt or reinstalled when the host kernel is updated. See for example the Debian wiki KernelDKMS page.
In contrast, a Docker image is generally supposed to be portable across hosts. If you upgrade the host's kernel, or if you run a FROM ubuntu:18.04 image on an Ubuntu 20.04 host, the image isn't really supposed to be aware of this.
In your particular case, you can't get the kernel headers you need, because they're not part of the Ubuntu 18.04 distribution. For this particular case it might be possible to get the headers from the later version of Ubuntu, but it might not be possible in the general case; maybe because the system is actually running plain Debian or RHEL and the kernel build is different, maybe because the operator built their own kernel.
Since a Linux kernel module is so specific to the host it runs on, and since it can bypass any and all security concerns, it's not appropriate to try to install one in a container. Do it directly on the host instead.

How to install apt in Docker machine?

I'm SSH'd into a Docker VM (the default machine) and did a apt-get update and this is what I got:
I'm not a huge Linux user; how do I install apt in a Docker machine? I'm ultimately wanting to install vim and/or nano via apt-install on the machine.
Working with TinyCore distribution and installing apt is not a good selection. instead you could use lubuntu
TinyCore Dist comes with tce-load package. Which you can use to download the packages. example:
tce-load -wi vim.tcz or tce-load -wi nano.tcz
ASR has the correct answer. I just wanted to include some things in case others read this post.
A list of available packages for Tiny Core Linux (TCL) is here (note, I have TCL version 8.2.1 installed and this list of showing for TCL version 10.x, but I think the package names stay the same for the most part):
http://distro.ibiblio.org/tinycorelinux/10.x/x86/tcz/
And a TCL cheat sheet for installing packages is here:
http://wiki.tinycorelinux.net/wiki:package_management_cheat_sheet
End result: =)
As there are no package managers apt, yum, apk inside docker machine, my case docker toolbox on Windows, and windows does not dispone with Linux package managers unless using cygwin or other workaround, I used Windows 10 Pro Ubuntu subsystem, where it is possible to use apt.

Can I Install Docker Over cPanel?

Can I install Docker over a server with pre-installed cPanel and CentOS 7? Since I am not aware of Docker, I am not completely sure whether it will mess with cPanel or not. I already have a server with CentOS 7 and cPanel configured. I want to know if I can install Docker over this configuration I mentioned without messing up?
Yes you can install docker over cPanel/WHM just like installing it on any other CentOS server/virtual machine.
Just follow these simple steps (as root):
1) yum install -y yum-utils device-mapper-persistent-data lvm2 (these should be already installed...)
2) yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
3) yum install docker-ce
4) enable docker at boot (systemctl enable docker)
5) start docker service (systemctl start docker)
The guide above is for CentOS 7.x. Don't expect to find any references or options related to Docker in the WHM interface. You will be able to control docker via command line from a SSH shell.
I have some docker containers already running on my cPanel/WHM server and I have no issues with them. I basically use them for caching, proxying and other similar stuff.
And as long as you follow these instructions, you won't mess-up any of your cPanel/WHM services/settings or current cPanel accounts/settings/sites/emails etc.
Not sure why you haven't tried this already!
I've been doing research and working on getting Docker working on cPanel. It's not just getting it to work on a CentOS 7 box but rather making it palatable for the cPanel crowd in the form of a plugin. So far I can confirm that it's absolutely doable. Here's what I've accomplished and how:
Integrate Docker Compose with cPanel (which is somewhat a step
further from WHM)
Leverage the user-namespace kernel feature in Linux so Docker
services can't escalate their privileges (see userns remap)
Leverage Docker Compose so users can build complex services and
start ready apps from the store with a click
Make sure services starting via Docker run on a non-public IP on the
server. Everything gets routed via ProxyPass
cPanel has been gracious to provide a Slack channel for people to discuss this upcoming plugin. I'd be more than happy to invite you if you'd like to be kept updated or to contribute. Let me know!
FYI, there's more info here on https://www.unixy.net/docker if you're interested. Please note that this plugin is in private beta but more than happy to let people use it!
Yes you could, in fact someone else has done it already: https://github.com/mirhosting/cPanel-docker

How to install docker-engine using docker binary without internet connection

I have downloaded docker binary version 1.8.2 and copied that to my backup server (centos server) which doesn't have internet connectivity. I have marked this as executable and started the docker daemon as mentioned in [https://docs.docker.com/engine/installation/binaries/][1]. But it doesn't seem to get installed as a docker service. For all the commands, I have to execute as sudo ./docker-1.8.2 {command}. Is there a way to install docker-engine as a service? Currently sudo docker version shows command not found. I'm a newbie to docker setup. Please advise.
Why not download the rpm package (there are also centos 6 packages), copy to USB stick and then to your server and simply install it with rpm command and that's it. That way you'd get the same installation as if you were to run yum.
Of course you may have some dependencies missing, but you could download all of these as well.
Firstly, if you're downloading bare binaries on an enterprise linux, you're probably doing things in a very bad way. Immediately, you're breaking updates and consistency, and leaving your system in a risky, messy state.
Try using yumdownloader --resolve to get the docker installable and anything it needs.
A better option may be to mirror the installation artifacts, and grab it from the local mirror, but that's beyond the scope if you don't do this already.

Resources