passinger
passinger

Reputation: 431

Can a docker image based on Ubuntu run in Redhat?

Read some PPTs, it seems that one container can run on different linux vendors. Is is true?

Upvotes: 17

Views: 12247

Answers (2)

arielf
arielf

Reputation: 5952

Yes. That's the main principle of docker.

It creates a "static container" in a chrooted env that is able to run on any linux because all the needed user-land dependencies are included in the (docker) image.

Since linux (the kernel running on the host) maintains a backward compatibility on system calls and their arguments, the idea can work across versions and even different distributions of Linux.

Of course, the binary architecture (e.g: amd64, aarch64, armel, armhf, i686, mips64el, ppc64el, s390x) needs to be the same on the source (docker container) and target system (host running the kernel) for the code in the container to be able to run.

Upvotes: 8

Bryan
Bryan

Reputation: 12190

Yes, for most applications this works. The kernel is whatever you are really running on (RedHat in your example) while the userspace is supplied by the container (Ubuntu).

Most Linux kernel variants are sufficiently similar that applications will not notice. However if the code relies on something specific in the kernel that is not there, Docker can't help you.

Docker itself relies on certain minimum kernel features, version 3.8 at the time of writing. https://docs.docker.com/engine/installation/binaries/

Upvotes: 9

Related Questions