Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

All images and containers disappeared after host kernel downgrade

Tags:

docker

Good day.

On the host machine was installed kernel 3.16. After installation the kernel 3.14 via deb package I lost all docker images and containers. Output of commands "docker images" and "docker ps -a" is empty. Is this normal behavior of docker?

Thanks.

like image 486
Denis Pitikov Avatar asked Oct 07 '14 13:10

Denis Pitikov


People also ask

Where did my docker images go?

The docker images, they are stored inside the docker directory: /var/lib/docker/ images are stored there.

Do containers use the host kernel?

No. Docker image/container only has the application layer of the OS and uses the kernel and CPU of the host machine. That's why docker container boot's so fast. In your host machine kernel is already running, so if you boot your docker container it will share the running kernel and start the container so fast.

Do containers share the same OS kernel?

Because containers share the same OS kernel as the host, containers can be more efficient than VMs, which require separate OS instances. Containers have better portability than other application hosting technologies: They can move among any systems that share the host OS type, without requiring code changes.

How do I list all containers?

Listing Containers. In order to list the Docker containers, we can use the “docker ps” or “docker container ls” command. This command provides a variety of ways to list and filter all containers on a particular Docker engine.


3 Answers

I will answer myself. It may be useful someone.

Docker used storage driver "aufs" on the old kernel. Therefore the module "aufs.ko" must be loaded. In the new kernel support aufs was not be enabled and docker began to use storage driver "devicemapper".

like image 124
Denis Pitikov Avatar answered Oct 05 '22 23:10

Denis Pitikov


To actually fix it on Ubuntu, run

sudo apt-get -y install linux-image-extra-$(uname -r)

This will install the aufs kernel module that docker requires but can be lost during kernel upgrades. Not sure why the package manager misses this dependency.

like image 35
DeepSpace101 Avatar answered Oct 06 '22 00:10

DeepSpace101


As Denis Pitikov points out, images and containers can disappear if the storage driver that created them (e.g. aufs) is no longer available.

When run on Ubuntu 14.04, the current Docker install script automatically installs the linux-image-extra-* package (suitable for your current kernel version). This includes the aufs kernel module.

On some systems, the linux-image-generic package may not be installed. On these systems, the next time you run a dist-upgrade, the kernel will be upgraded but the corresponding linux-image-extra-* will not be installed. When you reboot you won't have the aufs module, and your containers and images may have disappeared.

To fix it: first, check that you're running a generic kernel already:

$ uname -r
3.13.0-49-generic

If so, consider installing linux-image-generic:

$ apt-get install linux-image-generic

That will upgrade your kernel to the version required by that package and will install the -extra package too.

like image 22
z0r Avatar answered Oct 05 '22 23:10

z0r