I have windows server 2016 which has docker in built into it... so I am able to create windows image based containers and play around with them.
But now I want to create run linux based images, not able to do that... get below error
PS C:\Users\harishr> docker pull hello-world
Using default tag: latest
latest: Pulling from library/hello-world
image operating system "linux" cannot be used on this platform
I did installed docker-machine to create linux machine, but not getting command line options to do that
Related
We're building an OS image using yocto on Debian which outputs a bzipped volume which we can use as a base image in docker using docker import and we push this image to our registry to use as a base image.
cp build/tmp/deploy/images/raspberrypi4/device.tar.bz2 .
docker import device.tar.bz2 registry/base_image
docker push registry/base_image
We include the base image as part of another docker image:
FROM registry/base_image
ADD target/app.jar app.jar
ADD docker-run.sh run.sh
ENTRYPOINT "./run.sh"
This image is then successfully built by our CI on a linux (Amazon Linux 2) agent, and pushed to the registry. I'm able to pull the image and run it on a Mac with the current version of Docker for Mac.
However, trying to run the same docker image on a linux machine (even on the same linux build agent) results in the following exec format error:
standard_init_linux.go:228: exec user process caused: exec format error
Using an alternative docker image as the base allows the entrypoint to execute, so I'm pretty sure the issue is related to our custom base image.
As docker is largely cross platform, I'm surprised it works on MacOS (intel and m1) but not Linux (tested in Ubuntu and Amazon Linux). I've tried both the Ubuntu and Docker hosted apt repositories for the docker install.
How can I further debug?
The issue here was that the base image was arm based, and that Docker for Mac can run arm images out of the box, even on intel machines.
https://docs.docker.com/desktop/multi-arch/
Docker Desktop provides binfmt_misc multi-architecture support, which means you can run containers for different Linux architectures such as arm, mips, ppc64le, and even s390x.
There's a good write up here for running arm docker images on linux x86 hosts
https://matchboxdorry.gitbooks.io/matchboxblog/content/blogs/build_and_run_arm_images.html
After installing QEMU on your host OS, you need to mount the QEMU binary:
docker run -it --name your-container-name -v /usr/bin/qemu-arm-static:/usr/bin/qemu-arm-static your-arm-image
I want to create a docker container which installs an MSI application. I know i will be using the microsoft\widows\servercore image for this. Which host os i should use for this purpose. Will this image can be created and deployed in a Linux distribution??
If you're running a Windows container, you need to use Docker on Windows.
In general, containers can only run on the OS that they're designed for, but it is possible using Docker for Windows and Docker for Mac to run Linux containers since they provide a miniature Linux VM to run those containers. However, Docker on non-Windows OSes doesn't provide a copy of Windows to run containers with, so you have to use Windows to run Windows containers.
If you want your container to be deployable on a Linux host, it will need to be using a Linux container image.
I am new to the Docker/Kubernetes world in general.
As i am just starting with the whole architecture i have the following:
Azure Container Service -- up and running using Linux for master and agents
Docker for windows on my machine -- up and running
automated build for a .NetCore application on VSTS using Docker task to build and push the image to the Azure Container registry
Kubectl running as well kubernetes UI from master nodes
when building the .NetCore application from my machine using Docker commands and then publish it to the registry, Kubernetes is able to pull it and run it, but when the image is built and pushed by the VSTS build tasks kubernetes is failing to pull the images. after researching the error a bit, it turned out that the image coming from the VSTS build is made for windows and therefor cannot be pulled.
What is the difference between Docker Container for Windows and Linux, and how can we convert or specify the type while building the image.
What is the difference between Docker Container for Windows and Linux.
In short, Linux docker run on Linux and work with Linux kernel, Windows docker run on windows server 2016 or windows 10, work with windows hyper virtualization, and request windows dll and other packages.
So we can't run windows docker image on Linux docker.
how can we convert or specify the type while building the image.
As far as I know, we can't convert the docker image to another type.
We can use VSTS to build .NET core Linux Docker image, please refer to this blog.
Also, we can use different docker platform use Docker file to build docker image.
More information about how to build windows docker image with docker file, please refer to this blog.
More information about how to build Linux docker image with docker file, please refer to this article.
After docker image created, we can follow this article to push and pull an image from Azure container registry.
I installed docker CE on an Ubuntu 16.04, and when I try:
docker pull microsoft/windowsservercore
It fails:
Using default tag: latest
latest: Pulling from microsoft/windowsservercore
3889bb8d808b: Pulling fs layer
da87b55a9b63: Pulling fs layer
image operating system "windows" cannot be used on this platform
Is it possible to run a windows image on a linux host with docker? If yes, how should I do that?
Unlike other Virtual computing systems like Virtual Box or VMWare, Docker images are small and not fully complete stand alone entities.
The Docker image does not include the OS kernel, instead it uses the kernel of the Docker host
This makes the images very light weight, but it also means you won't be able to run a Windows image on a Linux host.
I want to introduce docker for my development environment.
I wanted to create a docker image from a existing linux machine.
But,I could not find a official method on docker documentation.
https://docs.docker.com/learn/
(I know there are some ways on the Internet to create a docker image like converting .iso file to .tar.gz file.
However,it's not official)
After that,I installed a docker image of Debian OS from Docker Hub with 'docker pull' command.
However,I could not find a correct version of Debian OS I wanted.
So, to get a OS of a correct kernel verion and a correct Debian os version,
after I install a docker image from Docker Hub, should I customize it?
Is there any way as an official manner to create a docker image from a exisiting linux machine?
Sounds like you should be looking at Hashicorp's packer, it would allow you to build your own Docker base images, from whatever base you wish.
https://www.packer.io/docs/builders/docker.html