unable to run docker container docker4dotnet/nanoserver - docker

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

Related

Docker installation on Mac m1

I am trying to install Docker desktop on Mac m1 but after installation dockers asks to execute following command.
docker run -d -p 80:80 docker/getting-started
But, it gives following error
Unable to find image 'docker/getting-started:latest' locally
docker: Error response from daemon: Get "https://registry-1.docker.io/v2/": read tcp 192.168.65.4:58764->192.168.65.5:3128: read: connection reset by peer.
See 'docker run --help'.
Why is it not pulling docker data?
(Sorry for the miss... going to try this again)
Try docker exec command before your command.
Like this docker exec docker run -d -p 80:80 docker/getting-started
"Tried using the docker exec command and it appears to have worked OK with two different ubuntu instances. Did not try Docker Desktop.
It kind of looks like there is a problem with Docker Desktop manipulating Terminal.app.
I’m using the macOS default zshell."
https://forums.docker.com/t/problems-getting-started/116487/9

docker run results in "unable to find image" if linked container not found

I'm getting possibly incorrect behavior and a bad error message if I run an image if a linked container is not found:
# this works:
> docker run --rm -d --name natsserver nats
> docker run --rm -it --name hello-world --link natsserver hello-world
# now stop natsserver again...
> docker stop natsserver
When I run hello-world again with the same command, I don't understand the first part of the error handling - why does docker try to pull?
> docker run --rm -it --name hello-world --link natsserver hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
Digest: sha256:b8ba256769a0ac28dd126d584e0a2011cd2877f3f76e093a7ae560f2a5301c00
Status: Image is up to date for hello-world:latest
docker: Error response from daemon: could not get container for natsserver: No such container: natsserver.
See 'docker run --help'.
And things get even worse if I try to run an image I have built locally:
> docker build -t nats-logger .
[...]
Successfully tagged nats-logger:latest
> docker run --rm -it --name nats-logger --link=natsserver nats-logger
Unable to find image 'nats-logger:latest' locally
docker: Error response from daemon: pull access denied for nats-logger, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.
So my questions are:
a) Is docker allowed to try to pull in this case, or is this a bad behavior?
b) Is this really a bad error message, or did I miss something?
P.S.: I'm running Docker version 19.03.2, build 6a30dfc on Windows 10.
Is docker allowed to try to pull in this case
Docker will pull image if it is not available on the machine.
Unable to find image 'hello-world:latest' locally
This warning message is not due to linking, it is because hello-world:latest is not exist in your system local images. so whe run docker run it will look on local then will pull from remote if not exist.
Now First thing, Better to use docker-compose instead of Legacy container links.
You can not link the container if it's not running. verify the container natsserver using docker ps and then if it is running then you can link.
docker run --rm -it --name hello-world --link natsserver:my_natserver_host hello-world
Once up you can then check the linking.
docker inspect hello-world | grep -A 1 Links
Legacy container links
Warning: The --link flag is a legacy feature of Docker. It may
eventually be removed. Unless you absolutely need to continue using
it, we recommend that you use user-defined networks to facilitate
communication between two containers instead of using --link. One
feature that user-defined networks do not support that you can do with
--link is sharing environment variables between containers. However, you can use other mechanisms such as volumes to share environment
variables between containers in a more controlled way.
simply try "docker login".
check if your image name is exist in docker hub
and check correct docker build command -> docker build -t image-name .
review the correctness of Docker file script

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

docker-compose doesn't see docker

If you launch docker-run by yourself it works, if you do this with docker-compose it doesn't
roman#debian ~/D/O/devops> docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
ca4f61b1923c: Pull complete
Digest: sha256:083de497cff944f969d8499ab94f07134c50bcf5e6b9559b27182d3fa80ce3f7
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://cloud.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
roman#debian ~/D/O/devops> docker-compose build app
Building app
ERROR: Couldn't connect to Docker daemon - you might need to run `docker-machine start default`.
roman#debian ~/D/O/devops>
Ok it's solved, previously been installing compose from repository, now installed through pip and it's working

Error in Docker for Windows tutorial

I'm new to Docker so I don't even know where to look. Here are the instructions:
Next, pull a base image that’s compatible with the evaluation build, re-tag it and to a test-run:
docker pull microsoft/windowsservercore:10.0.14393.321
docker tag microsoft/windowsservercore:10.0.14393.321 microsoft/windowsservercore
docker run microsoft/windowsservercore hostname
69c7de26ea48
And this is the error I get on the docker run step:
docker: Error response from daemon: container
6abd92755a8d5d13463eb74f9cc39a798ad0ec898bc1f80ff71205235b63a94f
encountered an error during CreateContainer: failure in a Windows
system call: No hypervisor is present on this system. (0xc0351000)
extra info:
{"SystemType":"Container","Name":"6abd92755a8d5d13463eb74f9cc39a798ad0ec898bc1f80ff71205235b63a94f","Owner":"docker","IsDummy":false,"IgnoreFlushesDuringBoot":true,"LayerFolderPath":"C:\ProgramData\Docker\windowsfilter\6abd92755a8d5d13463eb74f9cc39a798ad0ec898bc1f80ff71205235b63a94f","Layers":[{"ID":"17e4231d-380e-5dae-b734-0182defea00c","Path":"C:\ProgramData\Docker\windowsfilter\1226fe85e49abd361df8019342eec380ab577268565d2f3d813adcf37d1ccac4"},{"ID":"5fd42877-5043-5d33-a842-d70584cb03eb","Path":"C:\ProgramData\Docker\windowsfilter\53f86340ec419aae07b48e3624d00d7d6f5491f284d8d6e1e62fb7909d9a5fba"}],"HostName":"6abd92755a8d","MappedDirectories":[],"SandboxPath":"C:\ProgramData\Docker\windowsfilter","HvPartition":true,"EndpointList":["91c8a929-c40f-4ad3-a3d2-2906b51cb50a"],"HvRuntime":{"ImagePath":"C:\ProgramData\Docker\windowsfilter\1226fe85e49abd361df8019342eec380ab577268565d2f3d813adcf37d1ccac4\UtilityVM"},"Servicing":false,"AllowUnqualifiedDNSQuery":true}.

Resources