How to designate specific versions of e.g. Ubuntu containers? - docker

I just had my dockerized app not able to build for a day because apparently the "ubuntu:14.04" image still gets revved over time, and a newer OS level package version sabotaged me (this was unexpected - I'm careful to only apt-get install, pip install, etc. hardcoded versions of package so that I know when they change). Is there a way to control how/when I'm getting "newer 14.04's"? Not a desktop hack, I need it to work on the build server too when I submit my app to build.

Ubuntu publish dated tags to the registry.
$ docker run ubuntu:trusty-20160526 cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.4 LTS"

Related

Cannot uninstall Docker Desktop via Chocolatey

I've installed Docker 2.4 quite some time ago using Chocolatey (my OS is Win 10). Since updating Docker using choco upgrade all always failed, I did the updates manually via the Docker itself (right-click → Check for Updates → etc.). Now I'm on version 3.2.
Since I want to get rid of this manual update process, I wanted to uninstall Docker from Chocolatey. But executing choco uninstall docker-desktop fails with ERROR: Exception calling "GetFullPath" with "1" argument(s): "Illegal characters in path.".
Of course, I could uninstall Docker the usual Windows way. But how would I remove Docker from Chocolatey so that I can do a fresh install?
I was able to solve the issue by manually uninstalling Docker with default Windows tools.
Afterwards, I deleted the folder C:\ProgramData\chocolatey\lib\docker-desktop. This resulted in a clean environment when it comes to Docker, because Chocolatey seems to maintain all package-related things in the corresponding C:\ProgramData\chocolatey\lib\<<package>> folder.
Finally, I could install Docker again via choco install docker-desktop.

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.

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!

Docker hanging requiring reboot

We are running docker 1.7.1, build 786b29d on RHEL 6.7. Recently we have had multiple times when the docker daemon locked up and we had to reboot the machine to get it back.
A typical scenario is that a container that has been running fine for weeks suddenly starts throwing errors. Sometime we can restart the container and all is well. But other times all docker commands will hang, and restarting the daemon fails, and I see this in a ps:
4 Z root 4895 1 0 80 0 - 0 exit Aug23 ? 00:01:24 [docker]
Looking in the system log I've seen this:
device-mapper: ioctl: unable to remove open device docker-253:6-1048578-317bb6ad40cded3fbfd752d95551861c2e4ef08dffc1186853fea0e85da6b12b
INFO: task docker:16676 blocked for more than 120 seconds.
Not tainted 2.6.32-573.12.1.el6.x86_64 #1
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
docker D 000000000000000b 0 16676 1 0x00000080
ffff88035ef13ea8 0000000000000082 ffff88035ef13e70 ffff88035ef13e6c
ffff88035ef13e28 ffff88062fc29a00 0000376c85170937 ffff8800283759c0
0000000000000400 00000001039d40c7 ffff8803000445f8 ffff88035ef13fd8
Call Trace:
[] _mutexlock_slowpath+0x96/0x210
[] ? wake_up_process+0x15/0x20
[] mutex_lock+0x2b/0x50
[] sync_filesystems+0x26/0x150
[] sys_sync+0x17/0x40
[] system_call_fastpath+0x16/0x1b
The latest docker version is 1.12.1 and we are on 1.7.1. Can or should I install a new version? 1.7.1 is the version yum installs. If I did want a new version how would I install that (sorry if that is a dumb question, I am not a sys admin).
Googling, I found on this on a Red Hat site "Red Hat does not recommend running any version of Docker on any RHEL 6 releases." We have been running docker on RHEL 6 for a few years, so this confuses me. Upgrading to RHEL 7 is not really an option for us right now.
Can anyone shed any light on these issue? We need docker to work reliably without having to reboot often.
Docker 1.7.1 is really old by today's standards. There have been hundreds of bugs fixed, enhancements to driver stacks, security patches, and valuable features added in the versions since. It looks like you're having a issue with your storage stack, and there is a good chance this is fixed in a newer version.
Docker has stated that default versions in package management systems like yum and apt can be way out of date, and that you should use their repo. The best way to do this is add their Yum repo information to your system so you can install it like other packages. The instructions are here: Installation on Red Hat Enterprise Linux.
Note: This will allow you to install Docker, and the service will be called docker, but the package is docker-engine. This has confused some people in the past.
yum install docker-engine
Docker has also provided a script that does this to make things easier (run as admin/root):
curl -fsSL https://get.docker.com/ | sh
Don't use a RHEL6 based system.
RHEL6 uses a 2.6 kernel with backported fixes to keep Docker working. Docker would normally require a 3.10+ kernel. Docker dropped support for RHEL6 from v1.8 on so it's unlikely there will be any more packages for it.
If you must use RHEL6, don't use the default loopback devicemapper for storage. Setup an LVM thin pool for Docker to use.

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