Docker Community Forums

Share and learn in the Docker community.

Cant run containers

Hi, I’m new to dockers and i have a problem.

i tries to pull the hello world image from docker hub, and make my own. but every time i try to run any image, it immidietly stop. i really dont know what to do.

does anyone knows how to fix it?

Hello norsie,

Does it display a hello world like message before stopping ?
The purpose of this image is to just display a message. After that it will stop.

Best Regards,
fouscou.

Hello fouscou,
Actually I tried to run it with the desktop program.
It runs for a seconds and the running is immidietly ends.
I upload a picture to help you understand.

thank you.

i press the play button, the image status changes to running for a second and immidietly changes back to exited

Hello norsie,
Below is the message of the hello-world image : docker run hello-world

Unable to find image ‘hello-world:latest’ locally
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete
Digest: sha256:6a65f928fb91fcfbc963f7aa6d57c8eeb426ad9a20c7ee045538ef34847f44f1
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://hub.docker.com/

For more examples and ideas, visit:
https://docs.docker.com/get-started/

I ran the command from the terminal. The image just dsiplay that message and then stops.
Try to run from the terminal and what it is displaying.

Best Regards,
Fouscou

Hello fouscou.
I ran the command on windows powershell and i got this response:


the response does display the second part but not the "unable to find image ‘hello-world:latest’ locally.
and the program itself still can not run the image.

is that means there is something wrong?

Hello norsie,

Everything is fine. The container run from this image will just display that output and exit.
That is how it is designed.

When you run a container, docker tries to find the image locally first.
If he does not find the image locally it will pull it from the docker hub. that is why it is displaying that message from my command execution : unable to find image ‘hello-world:latest’ locally

Best Regards,
fouscou

Hello fouscou.
ok that is good to hear.

now if i may. i have another problem. i tried to create an image of .net framework console application that i made (nothing fancy), i tried to run it and i got this response:

do you know what is the best way to make an image from c# console app (no web api but it does use Newtonsoft.json nuget package), and the best way to run it? thank you!

Hello Norsie,
Incase you know about Dockerfile. Then read further:

You should have a working .NET app and a dockerfile specifying command to run a .NET app.

For example, I have a java program written in HelloWorld.java file. Then, I can simply configure a file called Dockerfile to run my program as part of docker image.

Procudure is that, I create a file as mentioned below and name is Dockerfile and then mention my filename and the command to compile the program i.e. javac HellWorld.java and the comand to run the java program i.e. java HelloWorld in the below dockerfile:

FROM openjdk:7
RUN mkdir p ~/Code
WORKDIR /Code
COPY ./HelloWorld.java /Code
RUN javac HelloWorld.java
CMD [“java”, “HelloWorld”]

Similarly, you can put .net command to run a .net program inside a dockerfile. Then just spin up an image using dockerfile to run your .net app

Regards,
Kush

norsie, I’ve been experiencing the same recently. Actually, one month ago our web application had some issues like these, but it was not only about technical side and code writing. Also it was a little about SEO, and editing some meta data, you know, so we’ve searched for reviews, and discovered a lot of positive reviews about Operatio Marketing guys. Did you hear something about them, or maybe you were ordering some SEO promotions from this agency?

Restart Docker Desktop: Select to restart Docker Desktop.

Run Diagnostics: Select this option to diagnose any issues on Docker Desktop. For detailed information about diagnostics, see Diagnose problems, send feedback, and create GitHub issues.

Clean / Purge data: Select this option to delete container and image data. Choose whether you’d like to delete data from Hyper-V, WSL 2, or Windows Containers and then click Delete to confirm.

Reset Kubernetes cluster: Select this option to delete all stacks and Kubernetes resources. For more information, see Kubernetes.

Reset to factory defaults: Choose this option to reset all options on Docker Desktop to their initial state, the same as when Docker Desktop was first installed.