Dokku - where is my application directory

I am trying to access the logs of my Node.js application, which is written in the mylogfile.log file inside the application directory. Using find / -type f -name mylogfile.log I managed to see this output:

 /var/lib/docker/aufs/diff/0303e86afdc58e13b5afcc07ea3694e0e9e6d5e5cf8530a0854a76fbe2baf574/app/mylogfile.log /var/lib/docker/aufs/diff/a9a0dab44456acd8b43915ed686c282b778ab99df31f62076082e121274ef6e2/app/mylogfile.log /var/lib/docker/aufs/mnt/0303e86afdc58e13b5afcc07ea3694e0e9e6d5e5cf8530a0854a76fbe2baf574/app/mylogfile.log 

What are these directories (if this previous application calls, why do I even need them, I really do not want to flood the hard drive with them), and which one is the directory of my current application?

Also inside ...mnt/ and ...diff/ there are many more folders with similar cryptic names.

+5
source share
2 answers

Please note that the Docker container file system is not intended for users to access the host. This is quite difficult in fact, because Docker uses a multi-level file system copy-on-write (for example, AUFS in your case, but this distribution, most Distros, except for Ubuntu, use Devicemapper instead of AUFS, IIRC). What you see is the file system levels , each of which contains a difference with one parent layer.

If you want to register material inside the application container, you should consider one of the following options:

  • Put your log files in the volume . You can set the host directory as a volume and write files there. You must specify mounts when creating the container using the -v flag ( -v <host-directory>:<dir in container> ):

     docker run -v /var/log/myapplication:/path/to/app/in/container myimage 
  • Write your logs in stdout and let Docker worry about the logs. You can access the log (yes, it will be only one large file) using

     docker logs <container-name> 

    You will also find the log file in your Docker working directory (usually /var/lib/docker ) in /var/lib/docker/containers/<container-id>/<container-id>-json.log . This log file will not be automatically modified, so it can become large.

  • Use an external logging service to write log data to another location on your network. Typical candidates would be syslog (old school) or create something like Logstash or Graylog .

+5
source

@helmberts answer is great and gives you everything you need, I try to give a tiny salt of salt (and something to dock, not docker).

The fact is that your application lives in a recoverable on-off environment. When deploying ( git push ), you kind of configure acester, every time you run your afterword applications, you create a clone that dies after you stop the container (view).

You can do dokku run myapp ls / to see how it looks. You can make changes ( dokku run myapp touch /mytouched.file ), but they are not saved ( dokku run gives you a fresh clone!) And is "lost" immediately. If you want to have files somewhere forever, use the volume and mount it in the application containers. There is a cool plugin (dokku-volume) for this .

I can’t say how to remove old differences.

+3
source

All Articles