SandeshKS1
Cadet
Cadet
  • 169 Views

Container Host OS Dependency

Jump to solution

Hi Team,

This is a doubt which i have from Day 1 i started reading about containers. 

Everywhere it mentioned that if we create a container in any Host OS, we can create a snap of the same container and run it on any other Host OS. My question is how? When we create a container there should be some kind of dependencies to the host OS, how can these dependencies supply from any other host OS?

Example: I am creating and container on Linux Host OS and creating a snap and trying to run the same on Windows, does that work without any help from the Linux environment? 

I read that we need to have Podman to run containers on Windows, and you need to have a connection to the Linux box for running the podman. Why? if we just place a container from Linux to windows platform, why Podman, and why Podman need Linux box ssh?

 

Labels (1)
2 Solutions

Accepted Solutions
Travis
Moderator
Moderator
  • 155 Views

Re: Container Host OS Dependency

Jump to solution

@SandeshKS1 -

Containers are meant to be a "portable" application and relatively platform agnostic. While there are some dependencies to run containers, it is generally around the container runtime and to ensure that the system active as the "compute node", that is the system executing the container has the needed runtimes and libraries to run any container.

As you mentioned, podman is being taught and utilized in Red Hat courses on containerization, but there are other options too such as Docker that some people might be more familiar with.

So to get to your question, you need to understand that a container is based on a container image ... this is crucial. Container images make up the foundation for the running container. The container image has all the needed applications, config files, binaries, and other dependencies to run the application. In order to launch a container on any operating system in any environment, you must first ensure access to the container image. 

A container image is usually downloaded from a container registry when you launch a new container. You are specifying the container image, registry, and in most cases the version of a container image before it is launched.

Many container images are based on an initial Linux image, but that is not always the case. Container images based on Linux or RHEL will a lot of times use the UBI7/UBI8 image which is a small universal base image. Container images can be build manually with tools like buildah or can be built with Containerfiles/Dockerfiles. Once you have a container image, you should be able to launch it on any "Supported" container platform.

For example, I quickly built an Ansible container image for myself so I could run and launch an Ansible container wherever I happened to be. This works easily on Linux-based systems since either Podman or Docker is sure to be readily available. So am I limited to using only Linux systems to launch and run my container ... definitely not. Using something called Docker Deskop, I can easily use that same container image to launch and run my Ansible container on both MacOS and Windows 10.

I still need to get some more documentation on Github, but the Ansible container image and process I'm referring to, I started as a Github project referenced here ...

https://github.com/tmichett/AnsibleContainer

 

Again in summary of the question ...

  • Container images take care of the application files, configuration files, and library dependencies
  • In order to launch a container from a container image, you need a container runtime environment (Docker, Podman, OpenShift, etc.)
  • Containers can be launched from Linux-based container images on any OS (Linux, MacOS, Windows)

As to why Podman ... that is a larger topic of conversation. To put things simply thought, in terms of Linux, Podman allows containers to be executed as part of user-space for general non-priviledged users and doesn't require a daemon running in the background like Docker. By running containers as an unpriviledged user, you are protecting the system more than running all containers as a root-level or system user.

Hope this helps,

Travis

Travis Michette, RHCA XIII
https://rhtapps.redhat.com/verify?certId=111-134-086
SENIOR TECHNICAL INSTRUCTOR / CERTIFIED INSTRUCTOR AND EXAMINER
Red Hat Certification + Training

View solution in original post

Reply
Loading...
ricardo_jun
Moderator
Moderator
  • 151 Views

Re: Container Host OS Dependency

Jump to solution

@SandeshKS1 Good questions, and good points @Travis ,

If your intent is to run a container that was created on a Linux OS, regardless of distro, the only dependency you need to satisfy is the underlying platform (x86_64,ARM,etc).

What that means is: if you have created a container on Ubuntu Linux x86_64 it will work on Fedora x86_64 or any other Linux distro. If your intent is to run x86_64 containers on ARM processors, you might run into problems as some x86_64 instructions are not available on an ARM-based Linux Distro,

About @Travis  point, using Docker Desktop for Windows will require you to enable one capability from Windows that supports Linux Kernels (Windows Linux Support or WSL2) and it eliminates the need to have a Linux host. The other way around is not possible.

If you create a Windows container, then it will only run on Windows hosts, period. 

I suppose something similar happens on Mac.

Again the underlying OS must provide an environment compatible to run your containers otherwise the container will not start.

Hope that clarifies your questions

 

Regards


Ricardo

View solution in original post

Reply
Loading...
4 Replies
Travis
Moderator
Moderator
  • 156 Views

Re: Container Host OS Dependency

Jump to solution

@SandeshKS1 -

Containers are meant to be a "portable" application and relatively platform agnostic. While there are some dependencies to run containers, it is generally around the container runtime and to ensure that the system active as the "compute node", that is the system executing the container has the needed runtimes and libraries to run any container.

As you mentioned, podman is being taught and utilized in Red Hat courses on containerization, but there are other options too such as Docker that some people might be more familiar with.

So to get to your question, you need to understand that a container is based on a container image ... this is crucial. Container images make up the foundation for the running container. The container image has all the needed applications, config files, binaries, and other dependencies to run the application. In order to launch a container on any operating system in any environment, you must first ensure access to the container image. 

A container image is usually downloaded from a container registry when you launch a new container. You are specifying the container image, registry, and in most cases the version of a container image before it is launched.

Many container images are based on an initial Linux image, but that is not always the case. Container images based on Linux or RHEL will a lot of times use the UBI7/UBI8 image which is a small universal base image. Container images can be build manually with tools like buildah or can be built with Containerfiles/Dockerfiles. Once you have a container image, you should be able to launch it on any "Supported" container platform.

For example, I quickly built an Ansible container image for myself so I could run and launch an Ansible container wherever I happened to be. This works easily on Linux-based systems since either Podman or Docker is sure to be readily available. So am I limited to using only Linux systems to launch and run my container ... definitely not. Using something called Docker Deskop, I can easily use that same container image to launch and run my Ansible container on both MacOS and Windows 10.

I still need to get some more documentation on Github, but the Ansible container image and process I'm referring to, I started as a Github project referenced here ...

https://github.com/tmichett/AnsibleContainer

 

Again in summary of the question ...

  • Container images take care of the application files, configuration files, and library dependencies
  • In order to launch a container from a container image, you need a container runtime environment (Docker, Podman, OpenShift, etc.)
  • Containers can be launched from Linux-based container images on any OS (Linux, MacOS, Windows)

As to why Podman ... that is a larger topic of conversation. To put things simply thought, in terms of Linux, Podman allows containers to be executed as part of user-space for general non-priviledged users and doesn't require a daemon running in the background like Docker. By running containers as an unpriviledged user, you are protecting the system more than running all containers as a root-level or system user.

Hope this helps,

Travis

Travis Michette, RHCA XIII
https://rhtapps.redhat.com/verify?certId=111-134-086
SENIOR TECHNICAL INSTRUCTOR / CERTIFIED INSTRUCTOR AND EXAMINER
Red Hat Certification + Training

View solution in original post

Reply
Loading...
SandeshKS1
Cadet
Cadet
  • 141 Views

Re: Container Host OS Dependency

Jump to solution

@Travis Thank you.

0 Kudos
Reply
Loading...
SandeshKS1
Cadet
Cadet
  • 140 Views

Re: Container Host OS Dependency

Jump to solution

@ricardo_jun Thank You.

0 Kudos
Reply
Loading...
ricardo_jun
Moderator
Moderator
  • 152 Views

Re: Container Host OS Dependency

Jump to solution

@SandeshKS1 Good questions, and good points @Travis ,

If your intent is to run a container that was created on a Linux OS, regardless of distro, the only dependency you need to satisfy is the underlying platform (x86_64,ARM,etc).

What that means is: if you have created a container on Ubuntu Linux x86_64 it will work on Fedora x86_64 or any other Linux distro. If your intent is to run x86_64 containers on ARM processors, you might run into problems as some x86_64 instructions are not available on an ARM-based Linux Distro,

About @Travis  point, using Docker Desktop for Windows will require you to enable one capability from Windows that supports Linux Kernels (Windows Linux Support or WSL2) and it eliminates the need to have a Linux host. The other way around is not possible.

If you create a Windows container, then it will only run on Windows hosts, period. 

I suppose something similar happens on Mac.

Again the underlying OS must provide an environment compatible to run your containers otherwise the container will not start.

Hope that clarifies your questions

 

Regards


Ricardo

View solution in original post

Reply
Loading...
Join the discussion
You must log in to join this conversation.