3

I'm new to Docker. I have looked at many tutorials, however, this is still not clear to me :

For example, If I create a docker image on a system which is using Ubuntu as the host OS. Can I then later port and use this same docker image on a different computer using a different flavour of Linux for the host OS, for example CentOS or any other?

3

Yes, as long as you have the Docker daemon running on the CentOS. Docker heavily utilizes a set of kernel features - namespaces and cgroups. That set comes native for all Linux derivatives.

In terms of 'porting' the image, you have 2 widely used options:

  1. docker save on your Ubuntu host. Get the saved archive to your CentOS and load the image with docker load

  2. The above option is not so convenient for the standard CI/CD stack, so you might just push your image from your Ubuntu host to a so called registry. Once the image is in your registry, you could pull it from your CentOS host.

| improve this answer | |
  • Thanks for your reply. I guess it gets more complicated porting an image from a Linux host to a Windows host and vice-versa? – Engineer999 May 28 at 16:31
  • You can run Linux containers using Docker desktop on windows out of the box. See docs.docker.com/docker-for-windows – M_dk May 29 at 7:05
  • Note that you can run your Linux-based containers on Windows, because of stuff that goes on in the background seamlessly, sort of, but you can't run Windows-based containers on Linux. I say sort of seamlessly, because you need to start the docker daemon with a special flag, but other than that it's the same. Also, for Windows, you could look into running docker on the Windows Subsystem for Linux: docs.docker.com/docker-for-windows/wsl – A Moustache May 29 at 7:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.