Search code examples
dockerdocker-composedocker-swarm

Where to find publish files of a dotnet application build using docker-compose build in a docker container using swarm?


I have a file that I need to access inside the publish folder of my dotnet app. I 'm pretty new to docker and not really that familiar with the ins and out so I would really want some help.

We have an application deployed using docker swarm. Inside it are several applications(containers?), I particularly need to access a log folder inside the app but I have no clue how to locate the build files inside a docker image in swarm.


Solution

  • First thing's first, in the container world you need to start writing everything you can (if possible) to std out. If you do that, you can use

    docker service logs <servicename> and retrieve the joined logs from all replicas in the set.

    If you need to access the files,however, if your base image has a shell on it, you can issue the

    docker exec -it <containername> bash

    In most cases, the directory you're running the application from will be the working directory from which dotnet is run, so the logs should be relative to that directory.

    command to access it like you would any linux system. From there you can navigate to wherever the logs are and cat them. If you need to send the files somewhere, you'd be best to use curl and post them somewhere as you won't have access to the files unless you created a volume to place the files in.