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

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.

Related

unable to run docker container docker4dotnet/nanoserver

Learning docker following a course in udemy. i have all the prerequisites like docker desktop and switched to windows container. While trying to run a container using
docker container run docker4dotnet/nanoserver hostname
getting error like below
Unable to find image 'docker4dotnet/nanoserver:latest' locally
latest: Pulling from docker4dotnet/nanoserver
b5c97e1d373f: Extracting [==================================================>] 103MB/103MB
docker: failed to register layer: re-exec error: exit status 1: output: hcsshim::ProcessBaseLayer \?\C:\ProgramData\Docker\windowsfilter\90f22cdfe817e491c24b8e26f35b4ec43c6477ce0c86cdbfb95a59e2606762a5: The semaphore timeout period has expired.
unable to figure it out. can some one help on this
NOTE : tried to switch the container to linux but it says
Unable to find image 'docker4dotnet/nanoserver:latest' locally
latest: Pulling from docker4dotnet/nanoserver
b5c97e1d373f: Downloading
docker: image operating system "windows" cannot be used on this platform.
NOTE 2 : Even tried
docker run -d -p 8090:80 docker/getting-started it says below even though windows container is selected
PS C:\WINDOWS\system32> docker run -d -p 8090:80 docker/getting-started
docker: Error response from daemon: operating system on which parent image was created is not Windows.
use this lines in cmd:
docker pull mcr.microsoft.com/windows/nanoserver:20H2
docker container run mcr.microsoft.com/windows/nanoserver:20H2 hostname

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

Application not running, if I load .tar and run image in docker

I'm loading tar file using:
$docker load -i C:/temp/new/testing.tar
Now I did:
$docker images
New image, "testingready", can be seen.
now I'm running this image:
$docker run testingready
Running on http://0.0.0.0:5000/
Restarting with stat
Debugger is active
Debugger PIN: 201-301-249
And my docker-machine ip is some xxx.yyy.zzz.aaa
Now I'm trying to run my application on xxx.yyy.zzz.aaa:5000 its not running,
As in parent system(where i created image) it running. I'm not getting where is the problem.

Docker container not running

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

Docker: save internal hd contents

is there a way to save the contents of a container's "internal" HD. I have tried to use the docker commit but when I shut down the container and turn it on again, the contents that I have downloaded or generated inside the container (logs, etc) are gone.
When you start the container back up do you use docker start or docker run?
docker run -i -t docker/image /bin/bash will start a NEW container with the information from the original imagefile.
docker start {dockercontainerID} will restart a previously running container. you can get a list of previous dockers with docker ps -a
If you have save a docker with docker commit {runningdocker} docker/image2 you will use the new image name. ie `docker run -ti docker/image2 /bin/bash

Resources