Docker container not running - docker

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...

Related

unable to start docker : no such container after save and load image

I have saved docker image and then load image.
$ sudo docker load -i e7bdb77cdcd8.tar
the images is loaded correctly
however i cannot start docker.
$ docker start e7bdb77cdcd8
Error response from daemon: No such container: e7bdb77cdcd8
Error: failed to start containers: e7bdb77cdcd8
docker start is used to start one or more stopped containers.
After you use docker load -i, it should load the artifact as a new docker image, you could see it using docker image ls.
Then, you should use docker run $your_loaded_image to run it.

Docker run -v : Unable to mount a bind volume : "invalid volume specification"

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.

Docker container exits immediately on `docker start`

I'm trying to start a docker container with docker start my_container, but it is exiting immediately. It works fine on some machines, but not on others. Here's my process:
Pull an image via docker pull <repo>:latest
Create a container via docker create --name my_container <repo>:latest
Start the container via docker start my_container
When I check the running docker processes via docker ps -a, I see that the status of my_container is Exited (1) 2 seconds ago.
When I run docker logs my_container, the only output is:
standard_init_linux.go:190: exec user process caused "exec format error"
The underlying issue in my case was an architecture mismatch.
My Dockerfile was using an amd64 base image. I built an image from this dockerfile and pushed it to a remote repository. I then pulled the image onto a device with arm32v7 architecture, created a container from the image, and tried to run the container.
A docker image built from the base image below will work on amd64 - it will not work on arm32v7.
FROM amd64/ros:kinetic-ros-core-xenial
A docker image built from the base image below will work on arm32v7 - it will not work on amd64.
FROM arm32v7/ros:kinetic-ros-core-xenial
A docker image built from a Dockerfile with the base image defined as below will default to the architecture of your current machine.
FROM ros:kinetic-ros-core-xenial

Cloudera quickstart docker: unable to run/start the container

I am using windows 10 machine, with Docker on windows, and pulled cloudera-quickstart:latest image. while trying to run it, I am getting into below error.
can someone please suggest.
docker: Error response from daemon: oci runtime error: container_linux.go:262: starting container process caused "exec: \"/usr/bin/docker-quickstart\": stat /usr/bin/docker-quickstart: no such file or directory"
my run command:
docker run --hostname=quickstart.cloudera --privileged=true -t -i cloudera/quickstart /usr/bin/docker-quickstart
The issue was that I have download docker separately and created the image with this command, which is not supported in cloudera 5.10 and above.
tar xzf cloudera-quickstart-vm-*-docker.tar.gz
docker import - cloudera/quickstart:latest < cloudera-quickstart-vm--docker/.tar
so I finally removed the docker image and then pulled it properly
docker pull cloudera/quickstart:latest
now docker is properly up and running.
If you had downloaded CDH v5.13 docker image, then the issue might be mostly due to the structure of the image archive; in my case, I found it to be clouder*.tar.gz > cloudera*.tar > cloudera*.tar ! Seems the packaging was done by fault and the official documentation too doesn't capture this :( In which case, just perform one more level of extraction to get to the correct cloudera*.tar archieve. This post from the cloudera forum helped me.

Connect to windows image fails with cmd

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.

Resources