-1

I am writing docker container. I it stands up but in my opinion, it does not work. I want to run dotnet app, that uses rabbitmq to communication. After running command: 'docker-compose logs mlmodule' it does not show any logs (but it should). I think that it is caused by wrong image code. I am newbie to docker and docker-compose.

This is the code of image

#docker base SDK image
FROM mcr.microsoft.com/dotnet/sdk:5.0 as build-env
WORKDIR mlmodule
#copy the CSPROJ file and restore any dependecies
COPY mlmodule/*.csproj ./
RUN dotnet restore
#copy project files and build release
COPY / ./
RUN dotnet publish mlmodule.sln -c Release -o out
#Generate runtime image
FROM mcr.microsoft.com/dotnet/runtime:5.0.9-alpine3.13-amd64
WORKDIR mlmodule
COPY --from=build-env mlmodule/out .

And thats the code of docker-compose:

rabbitmq:
image: rabbitmq:3-management-alpine
container_name: 'rabbitmq'
ports:
  - 5672:5672
  - 15672:15672
volumes:
  - ~/.docker-conf/rabbitmq/data/:/var/lib/rabbitmq/
  - ~/.docker-conf/rabbitmq/data/:/var/log/rabbitmq/
networks:
  - rabbitmq_go_net


ml-module:
build: ./mlmodule/
container_name: ml-module
environment:
  CLOUDSDK_PYTHON: /usr/bin/python3
  LD_LIBRARY_PATH: /usr/local/lib
depends_on:
  - rabbitmq
tty: true
networks:
  - rabbitmq_go_net

EDIT:

I propably fixed rabbitmq container, now I see logs:

 ml-module    | Could not execute because the specified command or file was not found.
 ml-module    | Possible reasons for this include:
 ml-module    |   * You misspelled a built-in dotnet command.
 ml-module    |   * You intended to execute a .NET program, but dotnet-MLModule.sln does not exist.
 ml-module    |   * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
  • Is there another environment where the same application _does_ produce output? There's an incidental mention of Python; is the core application Python or C#? The `environment:` settings seem suspicious to me; you shouldn't usually need to manually specify `networks:` or `container_name:`; but for RabbitMQ specifically you usually should specify `hostname:` lest it misplace data on restart. – David Maze Sep 14 '21 at 15:57
  • did the `docker-compose logs mlmodule` command produce an error of its own or just output nothing and went to the next line? try running the next command `docker-compose logs ml-module` instead – Noam Yizraeli Sep 14 '21 at 18:38
  • @DavidMaze 1. The mlmodule is dotnet app,, and it produces logs on when I run it on vsc ide. Core app is written in java. 2. I mentioned python path because it was required, when it was not there, application threw "Could not find Open_ssl path". 3 My app contains more containers, and i wanted to isolate them from the rest, thats why I specified network. – Jakub Kołacz Sep 15 '21 at 07:21
  • @NoamYizraeli It have tried to see logs before writing this post. There's nothing in here. It seems like container is being set up, but app inside does not run properly. There is something wrong with image imo – Jakub Kołacz Sep 15 '21 at 07:26
  • 1
    @JakubKołacz at the moment it's hard to recreate your issue or wrap our heads around it, please debug your issue and remove as much as possible so we can experience your issue for ourselves and try and help you to fix it – Noam Yizraeli Sep 15 '21 at 07:32
  • @NoamYizraeli after debugging session, I think that I fixed rabbitmq ocntainer and found out propably cause. I leave logs of ml-module in edit – Jakub Kołacz Sep 15 '21 at 09:44
  • they are what please? – Noam Yizraeli Sep 15 '21 at 09:45
  • @NoamYizraeli look at post, I pasted them – Jakub Kołacz Sep 15 '21 at 09:49
  • did you check the proposed causes from the logs? – Noam Yizraeli Sep 15 '21 at 09:50

1 Answers1

0

The solution is to add this line to dockerfile, it was configurated wrongly. Currently dotnet sdt does not have dotnet-ef commang:

 RUN dotnet tool install -g dotnet-ef --version 5.0

I had to put it manually into dockerfile. Link to help artice:

Command dotnet ef not found in .NET Core 3