Dominik Krulak
Dominik Krulak

Reputation: 611

Are official docker images cross-platform compatible?

What I mean is if I can run for example the official docker image DEBIAN and on top of that run the official docker image NGINX with both same supported architecture e.g. Linux x86-64?

Will it work like I would install NGINX package for DEBIAN operating systems in non-docker way?

Because I'm learning docker and I've came across that NGINX was build and run from official NGINX repository for DEBIAN OS on top of the official docker image DEBIAN?

Is that a clue that docker images are not cross-platform compatible?

I've also came across this helpful question.

Upvotes: 2

Views: 500

Answers (1)

Jay
Jay

Reputation: 2200

If by cross-platform you mean whether a docker image built on an x86_64 machine will run on a ppcle64 machine, then the answer is no (there are ways around it by using an emulator, but generally speaking the answer is no).

If you mean, whether an Ubuntu container can be run on a Debian host, then yes (provided host kernel version is compatible, which it will be, since you were able to install docker).

As for the question of why NGINX official image is Debian, the developers might have their own reasons. In fact, the official repo has Alpine flavour image as well. You can modify the Dockerfile to use Ubuntu image, make the necessary modifications (such as the ubuntu version of the installer) and build it on a Debian host. It will produce an Ubuntu image which will run an Ubuntu container on any Linux, Unix, MacOS or Windows (using Linux VM) . You can build that Dockerfile as is on an Ubuntu host and it will create the same nginx:latest image as you would download from dockerhub. This can be verified using the checksum.

Upvotes: 2

Related Questions