0

Starting with Docker for Windows and C# applications.

I've been able to do some basic building and running of dockerfiles. However, I've run into the first application that doesn't run right out of the gate, and am uncertain how I would begin to troubleshoot it.

What are some of the techniques used when moving an app into a container (Windows image) for the first time?

2 Answers 2

2

The first thing you'll want to do is look for errors. It sounds like you have a Dockerfile that is creating an image, but when you run the image it appears to not do anything. There are two immediate things you can do to troubleshoot this:

  1. Do not use the -d flag when running the image. This flag runs the container in detached mode and will not display container output to the console.
  2. Examine the logs from the container. Even though the container does not appear to be running, it is most likely crashing on start. You can verify this by using docker ps -a which will show you all containers (including ones that have stopped due to crashes).

Once you know what the error is you can look at whether this is a problem with your startup script or the Dockerfile. Based on what you've described so far this sounds like you could be missing files in the right location, or the Entrypoint or CMD is incorrect.

0

Review the containers' output in your terminal. If it was run in detached mode (with -d flag) then the you can review its output using docker container logs <container name>.

If the container doesn't behave as planned but also doesn't exit, you may want to diagnose parts of your application from inside the container. You can do this by creating an interactive shell inside it with the command: docker container exec -it <container name> sh.

Another way to interact with the container's file system would be to mount some of its content on the host machine, then you will have it available to any tools you might want to use from your machine. This can be done by adding the option -v /path/on/host:/path/in/container when running the image.

For a more focused answer, it will help if you provide an example of what Error or behavior occurs. Good luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.