I have created a docker image from my windows 7 tar backup. Everything is fine and docker images shows the image.
Now, I do not know how to create a container from this image. It seems it does not know the cmd command at all.
I tried the following:
# docker run -it 8bf47055c3d3 cmd
exec: "CMD": executable file not found in $PATH
docker: Error response from daemon: Container command not found or does not exist..
s# docker run -it 8bf47055c3d3 "Windows\System32\cmd.exe"
exec: "CMD": executable file not found in $PATH
docker: Error response from daemon: Container command not found or does not exist..
Is there any way to connect?
I did not create any Dockerfile. Just took a .tgz backup of the windows C:\ drive and ran the following command in my Linux to create the image:
cat file.tgz | docker import - devops:latest
I don't understand what you hope to do with this image.
Docker, used on Windows, is used in a boot2docker (tinycore) VM, where it can run container based on Linux images. It would not know how to interpret Windows system calls.
You would need docker for Windows (Windows 10 with Hyper-V maybe, or Windows Server 2016 TP4+, as in "Running Docker Containers On Windows Server 2016 (Quick Start Guide)") to hope running such an image.
Related
I'm quite new to Docker. I'm running on Windows 10 Enterprise and am trying to containerize an existing app that runs on windows (so it's a Windows container). I don't know if this matters but the container is rather large (8 GB).
I need to share a config file (that lives on the host) with the container that the app will use when starting. I was thinking that a bind volume was simplest.
Problem: On running the image I get docker: Error response from daemon: invalid volume specification: '<source path>:<target path>'
Container was built with this command:
docker build -t my_image .
Here is the Dockerfile:
FROM mcr.microsoft.com/dotnet/framework/runtime:4.8
WORKDIR /app
COPY . .
ENTRYPOINT .\application.exe ..\Resources
Here is what I've tried
docker run -it -v c:/Users/my_user:/app my_image
I've tried every combination of C:/, C:\, C:\\, /c/, //c/, \c\, \\c\, etc.
I've tried multiple combinations of /app, //app, \app, \app, C:\app, etc.
I've also tried with and without :rw appended to the end
I've tried the ```--mount``` syntax which consistently outputs: docker: Error response from daemon: invalid mount config for type "bind": invalid mount path: '/app'. (tried a bunch of variations of /app here too)
I've tried every possible combination (except the right one). Please help!
Since you are using a Windows container, your file path will change. Try the below command, from the docs Persistent Storage in Windows Containers
docker run -it -v c:\Users\my_user:c:\app my_image
If you are using a powershell and trying to run docker using docker run command you can try this approach. It worked for me in windows powershell (vs code powershell)
docker run -v ${pwd}\src:/app/src -d -p 3000:3000 --name react-app-c2 react-app-image
Here react-app-c2 is container name and react-app-image is image name
-v is for volume and ${pwd} is for current working directory
/app/src is for the containerdirectory.
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",
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 .
New to docker and I'm using Windows 7 SP1. It looks like docker is running fine in my machine as I have tried running hello-world by command docker run hello-world as instructed in the tutorial and got expected result. Now all I'm trying to do is create a docker image for a .net core console app. My app built and ran. but while building docker image by command docker build -t myapp . I get the below error
error during connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.30/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&c
puquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&labels=%7B%7D&memory=0&memswap=0&networkmode=default&rm=1&shmsize=0&t=
duke&target=&ulimits=null: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on
Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
Below my Dockerfile
FROM microsoft/dotnet:1.1-runtime-nanoserver
WORKDIR /DotNetConsole
COPY /bin/Debug/netcoreapp1.1/publish/ .
ENTRYPOINT ["dotnet", "DotNetConsole.dll"]
I could get around this problem by starting the "Docker QuickStart Terminal" installed with the docker tools, and running the commands for building the docker images from there.
If I used GIT BASH instead of the Docker QuickStart Terminal to execute the commands, I would get this kind of error. So it seems that if the commands are not executed from the Docker terminal itself, these errors show up.
I have created a docker image which is a python script based on a centos image. This image is working in the host system. Then I converted that image in tar.gz format. After that when I imported that tar.gz file into docker host(in a ubuntu system), it is done properly and the docker images list shows me the image listed in there. Then I tried to run the container in interactive mode using the following command:
$docker run -it image_name /bin/bash
it throws the following error:
docker: Error response from daemon: invalid header field value "oci runtime error: container_linux.go:247: starting container process caused \"exec: \\\"/bin/bash\\\": stat /bin/bash: no such file or directory\"\n".
Although docker run -it image_name /bin/bash command is working for all other images in my system. I tried almost all the means, but got no output apart from this error.
docker run -it image_name /bin/sh works for me! (Docker image, like Alpine, does not have /bin/bash).
I've just run into the same issue after updating Docker For Windows. It seems that it corrupted some image layers.
I cleared all the cached containers and images by running:
docker ps -qa|xargs docker rm -f
docker images -q|xargs docker rmi
The last command returned a few errors (some returned images didn't exist anymore).
Then I restarted the service and everything was running again.
I had the same issue, and it got resolved, after following the steps described in this post...
https://www.jamescoyle.net/how-to/1512-export-and-import-a-docker-image-between-nodes
Instead of saving the docker image (I) as .tar and importing, we need to commit the exited container, based on the image (I), as new image (N).
Then save the newly committed image (N) as .tar file, for importing into a new environment.
Hope this helps...
I'm new to Stack Overflow and I checked the similar issue in Stack Overflow but not found what I expected answer. so hopefully my questions aren't too silly.
I cannot start my container after I created it.
I use the command:docker start 6069dba3cb02
and get the below error message:
root#boot2docker:/mnt/sda1/var/lib/docker/containers# docker start 6069dba3cb02
Error response from daemon: Cannot start container 6069dba3cb02: [8] System error: exec: "up3": executable file not found in $PATH
Error: failed to start containers: [6069dba3cb02]
The container info as below:
Even I use the other command: "docker restart 6069dba3cb02" or "docker run ubuntu:14.04 up3", I still get the error
Docker info: Operating System: Boot2Docker 1.8.0 (TCL 6.3);
Install path: https://github.com/boot2docker/windows-installer/releases
What do you want to achieve with the parameter up3? This command is executed inside of the container you just started. But Ubuntu does not know this command, because it simply does not exist in the plain Ubuntu image (that's what the error message said: executable file not found).
Therefore you have to install your up3 tool before you try to access it. Or you have a misunderstanding about what up3 should do with your container, i don't know.
Try to replace up3 with ls / or something like this to understand what the last arguments do when running docker:
docker run --rm ubuntu ls /
--rm removes the container after the command exits.
To give your container the name up3, you have to add this to your command:
docker create --name up3 ubuntu:14.04
Then you can start your container by name:
docker start up3