Linux container on server 2019 machine

225 Views Asked by At

I created a docker image on my red hat Linux . The base image is a centos image and has a application installed on it. I am able to run the image on dockers on multiple Linux machines .

I then saved the image and then copied the image on windows server 2019 machine with all latest updates installed .

I then loaded the image using

docker load -i img.tar 

When I try to run the container I get the following error

PS C:\Users\manish\Desktop\docker> docker run -dit  --name manish22ct   docker_22_oct:1.0
99d061211a5cc682408a2556946266e0df2596f3a4d233a557d99e28cd24371e
C:\Program Files\Docker\docker.exe: 
Error response from daemon: container 99d061211a5cc682408a2556946266e0df2596f3a4d233a557d99e28cd24371e encountered an error during CreateContainer:
failure in a Windows system call: The virtual machine or container JSON document is invalid. (0xc037010d)



extra info: {"SystemType":"container","Name":"99d061211a5cc682408a2556946266e0df2596f3a4d233a557d99e28cd24371e","Owner":"docker","LayerFolderPath":"C:\\ProgramData\\docker\\lcow\\99d061211a5cc682408a2556946266e0df2596f3a4d233a557d99e28cd24371e","Layers":[{"ID":"cf1935b5-650d-57cc-81f0-469ceb110edf","Path":"C:\\ProgramData\\docker\\lcow\\04f407aadd6912e3bc76dcd858a2754acbf5a378ccef8a11ec1079c070900a4e\\layer.vhd"},{"ID":"fe9ae0e9-ed92-51ea-b423-098275f00ed8",
1

There are 1 best solutions below

0
On

Answering my own question to the best of my ability in case it helps someone .

I found that the docker daemon for Linux and windows are different. For Linux its provided by dockerhub but for windows its provided by Microsoft . Some images I downloaded from dockerhub like Cassandra doesn't work directly on windows too but run perfectly fine on Linux .

Sometimes these images run too .

In case you image is not running on both there is something in your image layer that is hindering your run on windows .

For windows I found that RUN command is something you should avoid . Check your dockerfile and remove all RUN commands and move all those in to a shell file say runMe.sh. At the end of all your commands in this shell file don't forgot to include tail -f /dev/null

Since only one CMD is allowed in dockerfile CMD ( /runMe.sh > /runMe.log 2>&1 ) is the only thing that would remain of RUN and CMD set of instructions in your dockerfile .

Create your image . It would run on both Windows and Linux .