How to install apt in Docker machine? - docker

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.

Related

How to install USBIP in Docker Container

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.

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 :)

Hash Sum mismatch error, and others, while Installing Docker on Ubuntu 18.04 VM (VirtualBox)

Preface that I'm running these commands on a VirtualBox VM, Ubuntu Server 18.04. Unfortunately I can't get the bidirectional clipboard to work so I have to post all the output as links. Super sorry about that.
I've been trying to install Docker on an Ubuntu 18.04 VM on VirtualBox running on a Windows 10 Home, Version 10.0.19041 host. I've been encountering issues at every turn.
First, I tried to install with apt-get after following the instructions on the Docker Ubuntu install tutorial, to no avail. I get an error with "Hash Sum mismatch" shown pretty frequently. I also tried running the convenience script (i.e. curl -fsSL https://get.docker.com -o get-docker.sh followed by sudo sh get-docker.sh) on a completely fresh machine, and got the same errors.
After I was unable to install with apt-get, I tried downloading the packages and installing manually. When trying to curl the packages with
sudo curl -k -O -L https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/amd64/docker-ce_18.09.9~3-0~ubuntu-bionic_amd64.deb
and the same curl for docker-ce-cli and containerd.io debs I'm able to complete the downloads just fine. Then, when I run
sudo dpkg -i ./docker-ce_18.09.9~3-0~ubuntu-bionic_amd64.deb
to install the packages, I get these dpkg Errors, claiming that the deb is corrupted. I get the same errors no matter which deb I specify.
I suppose at the end of the day, Docker isn't strictly necessary for the project I'm working on, but it's very frustrating that I'm at such a loss. I'd be very grateful if anyone can give me some guidance. Please feel free to comment if you need any more system info.
p.s. I've seen a couple theories but don't know how to address them.
Possibly, an issue with WSL2 and the Virtual Machine Platform on Windows. Discussed in this thread, but it didn't seem like anyone found a solution.
An issue related to apt-cache and /var/lib/apt/lists/*, which I've already cleaned cleared multiple times.
I've also run apt-get update more times than I can count.
Update here. In the end I was unable to install Docker on my VirtualBox VM. The thing that worked for me was booting up an Ubuntu 18.04 VM in VMware. With all the same specifications, I was able to install Docker and get my application running. If anyone comes back to this question and finds a fix for this on VirtualBox, please post it and I'll mark it as the answer!
The GCrypt so library has a real issue computing hashes when running VirtualBox or other VM software under Windows 10. I made a video about this.
https://youtu.be/inU8pQLXIkE
Here is the solution:
mkdir /etc/gcrypt
touch /etc/gcrypt/hwf.deny
cd /etc/gcrypt
sudo vi hwf.deny
(edit this file to read "all" without quotes on line 1
Save.
This will solve the issue.

How did Docker know to emulate arm architecture?

This was a huge surprise for me:
Today, using Docker For Mac (18.03.1-ce-mac65), I ran a Debian Stretch image. Inside the image I mounted the latest Raspbian Stretch image (2018-04-18-raspbian-stretch-lite) using mount. I then used chroot to this mounted Raspbian filesystem.
This is where it got weird. I was able to use apt (without any special modifications) to install software into this mounted filesystem.
Running:
dpkg --print-architecture
returned: armfh
and the software I installed (vim) worked like a charm
I was even able to compile a simple program using gcc and run it.
But, I need to know! How is this possible?
According to Docker:
Docker for Mac provides binfmt_misc multi architecture support, so you can run containers for different Linux architectures, such as arm, mips, ppc64le, and even s390x.
EDIT
On Linux, you can install qemu-user-static and then follow this git repo to get cross-architecture support!

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