I’m using Blackvue Sync with Docker Desktop under Windows.
When it runs, I can see console output from the python program in the Docker Desktop UI.
I’d like to look at the log after the desktop completes.
I searched the system for files created within 1 hour of a run.
I found about 20 files with .log extension in the directory "C:\Users\Tim\AppData\Local\Docker\log\host" but none of them contain the console output of the python program this is running in the container.
Is there a setting to enable saving of the console output into a file?
Or do I need to add something to the “docker-compose.yml”?
The file save needs to happen automatically, since the Docker Desktop is run from a script and is unattended.
Thanks - I was unaware of that command, so I searched and it appears to be intended for the command line.
I tried it, but got an error (Docker Desktop is not running now)
including the command docker logs 'blackvuesync' >> C:\Data\DEV\BlackVue_Sync\docker-logs-internal.txt
in the script that starts and stops docker desktop does not work. It creates a file, but it contains zero bytes.
I tried opening the terminal at the bottom of the Docker Desktop, and entered this command:
Further details:
From the windows CMD script that starts and stops docker desktop, the docker logs command fails:
c:\Data\DEV\BlackVue_Sync>docker logs 'blackvuesync' >> C:\Data\DEV\BlackVue_Sync\docker-logs--internal.txt
Error response from daemon: No such container: 'blackvuesync'
c:\Data\DEV\BlackVue_Sync>docker logs 'blackvue_sync' >> C:\Data\DEV\BlackVue_Sync\docker-logs--internal.txt
Error response from daemon: No such container: 'blackvue_sync'
At the time this command is run, Docker Desktop is running, and there is a blackvuesync container running.
The container name is displayed as blacvuesync and blackvue_sync in different places in Docker Desktop. I tried both, and neither one is recognized as a container in the docker logs command.
With compose deployments, the project name will be the folder name where the compose file is located, unless the project name is explicitly set. Thus, blackvue_snyc is the project name. Container names in compose deployments, use {project name}_{service name}-{replica number} by default, unless configured otherwise.
Instead of anticipating how the container name will be, you can either configure a fixed container name for the service in the compose file. Or just check the output of docker ps to find the container name, and use this name in your command.
Yes, but not 'blackvuesync'. Remove the apostrophes. If it were used as a quotation mark, it wouldn’t be included in the error message (Note that I tried as I wasn’t sure how PS handled these characters).
But even if you use th correct container name, you might get empty files depending on where the output goes in the container. To the error stream or the standard output stream. It seems Powershell handles the redirection the same way as Linux, so this would redirect the standard output (without error)
docker logs blackvuesync > out.txt
This would redirect only error messages (anything that was sent to the error stream actually)
docker logs blackvuesync 2> err.txt
And on Linux, this would redirect all outputs including error messages
docker logs blackvuesync &> all.txt
But it doesn’t work in my PowerShell so I tried this which worked: