I want to locate a container's log location.
I use Docker Desktop for Windows
I know that on linux they are at /var/lib/docker/containers/
But where is it. Is it hidden away somewhere in an inaccessible VM?
Windows 10 + WSL 2 (Ubuntu 20.04), Docker version 20.10.2, build 2291f61
Logging Driver
docker info --format '{{.LoggingDriver}}'
'json-file'
Docker Inspect LogPath
docker inspect --format='{{.LogPath}}' <Some_Container_id>
'/var/lib/docker/containers/bb69ae7df957c5f8c8b6d63372aa9cf9b94fa6ef0e44ccecbccb6d190baadb51/bb69ae7df957c5f8c8b6d63372aa9cf9b94fa6ef0e44ccecbccb6d190baadb51-json.log'
Docker Artifacts are stored in following location
DOCKER_ARTIFACTS == \\wsl$\docker-desktop-data\version-pack-data\community\docker
Location of container logs
DOCKER_ARTIFACTS\containers\[Your_container_ID]\[Your_container_ID]-json.log
Here is an example:
On windows you can find the containers logs inside:
C:\ProgramData\docker\containers\[Your_container_ID]\[Your_container_ID]-json.log
For windows , the container storage is the Hyper V's virtual Hard disk.You would have to connect to that hard disk to get the container logs.
See this lonk for more details :https://forums.docker.com/t/where-are-images-stored/9794/7
Related
I am a beginner at Docker. I need to create two containers for mongo and mongo-express. But, I'm getting an error as error during connect: This error may indicate that the docker daemon is not running.
Then I tried below steps:
I run the cmd as administrator. Then I run the command "C:\Program Files\Docker\Docker\DockerCli.exe" -SwitchDaemon. It didn't work for me. then I tried with 'C:\Program Files\Docker\Docker\DockerCli.exe' -SwitchDaemon way. Then I enabled hypervisor also. Still, I am getting the same error. When I ran the docker version command in cmd I received the below-mentioned outputs:
Then after I tried with cd "C:\Program Files\Docker\Docker" and ./DockerCli.exe -SwitchDaemon separately.
docker info command gives below mentioned error:
C:\Windows\system32>docker info
Client:
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc., v0.10.0)
compose: Docker Compose (Docker Inc., v2.15.1)
dev: Docker Dev Environments (Docker Inc., v0.0.5)
extension: Manages Docker extensions (Docker Inc., v0.2.17)
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
scan: Docker Scan (Docker Inc., v0.23.0)
Server:
ERROR: error during connect: In the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect.: Get "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/info": open //./pipe/docker_engine: The system cannot find the file specified.
errors pretty printing info
Did you install the Docker Desktop on your Windows PC? If not please install it and Run it. If you already installed it, please run it first!
Then you can see whether the docker engine is starting or not!
After the docker engine started check whether this error is still there. Most probably error will fix after doing that!
If the docker engine is not started, please uninstall docker and delete everything from Registry.
Press Win+R and %appdata%\Docker to go and delete all the files.
Then reinstall the docker, if better you can install the docker desktop. Because with the docker desktop, the docker provides a whole bundle with it! Then you will be able to install the docker for windows smoothly.
Because this error usually getting when the docker engine is not started. Also, this may happen missing Linux kernel on windows. Both issues will address with the correct installation of the Docker Desktop.
You can check whether you have a docker Linux subsystem running on your windows pc by running the following command on cmd,
wsl -l
If you get a result like this,
C:\Users\gayan>wsl -l
Windows Subsystem for Linux Distributions:
docker-desktop-data (Default)
docker-desktop
Then you are okay and ready to go.
If not, please try to uninstall and install the docker desktop
Make sure you delete the previous registry, To do that press Win+R and type Regedit Then go to HKEY_LOCAL_MACHINE -> SOFTWARE -> Docker Inc and delete that folder.
If still you are getting the same error, try to troubleshoot the docker desktop. you can refer to the docker documentation.
I have Windows.
I have tried to set up minikube as Docker Desktop and followed the instruction : https://minikube.sigs.k8s.io/docs/tutorials/docker_desktop_replacement/
I do not see any errors in cmd.
C:\WINDOWS\system32>minikube start --container-runtime=docker --vm=true
* minikube v1.28.0 on Microsoft Windows 10 Enterprise 10.0.18363 Build 18363
* Using the hyperv driver based on existing profile
* Starting control plane node minikube in cluster minikube
* Restarting existing hyperv VM for "minikube" ...
* Preparing Kubernetes v1.25.3 on Docker 20.10.20 ...
* Verifying Kubernetes components...
- Using image gcr.io/k8s-minikube/storage-provisioner:v5
* Enabled addons: storage-provisioner, default-storageclass
* Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
docker --version also works fine.
C:\WINDOWS\system32>docker --version
Docker version 20.10.21, build baeda1f
However when I try to do docker compose up I got an error: error during connect
d:\projects\ui-tests>docker compose up
error during connect: this error may indicate that the docker daemon is not running: Get "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/json?all=1&filters=%7B%22label%22%3A%7B%22com.docker.compose.project%3Dui-tests%22%3Atrue%7D%7D": open //./pipe/docker_engine: The system cannot find the file specified.
Can someone help with that?
UPD1:
I have run this command in cmd, but there was no output(do not know if it is ok):
C:\WINDOWS\system32>#FOR /f "tokens=*" %i IN ('minikube -p minikube docker-env --shell cmd') DO #%i
C:\WINDOWS\system32>
The error might have been caused because you are using hyper-v based docker deployment or because of exporting the variables incorrectly. I tried a different approach and it worked for me.
Instead of using hyper-v I have used wsl2 for docker. First you need to
install wsl refer to this doc for more information.
Next you need to download docker engine binary files from the official
docker site and make some configuration as mentioned in this doc.
Now you can install minikube for windows and select the driver as
docker now as docker path is accessible across the system docker-
compose will work fine.
Hope this will help you in resolving your issues.
I was not able to resole this problem. Rancher desktop was chosen instead
I have Windows 11 Home (which does not allow Hyper-V, only Pro edition does).
Installed WSL2 and Docker Desktop.
Installed Minikube using Chocolatey but it refused to start.
Searching on SO, I found this advice in several posts, but it failed to work.
PS C:\WINDOWS\system32> docker system prune
WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all dangling images
- all dangling build cache
Are you sure you want to continue? [y/N] y
error during connect: In the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect.: Post "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/prune": open //./pipe/docker_engine: The system cannot find the file specified.
PS C:\WINDOWS\system32> minikube delete
* Removed all traces of the "minikube" cluster.
PS C:\WINDOWS\system32> minikube start --driver=docker
* minikube v1.25.2 on Microsoft Windows 11 Home 10.0.22000 Build 22000
* Using the docker driver based on user configuration
X Exiting due to PROVIDER_DOCKER_VERSION_EXIT_1: "docker version --format -" exit status 1: error during connect: In the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect.: Get "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/version": open //./pipe/docker_engine: The system cannot find the file specified.
* Documentation: https://minikube.sigs.k8s.io/docs/drivers/docker/
I thought of trying to have Docker Desktop already running before I start minikube.
From the Windows Start menu, I ran Docker Desktop in Administrator mode.
Now I ran the command again
to remove old stuff,
PS C:\WINDOWS\system32> minikube delete
* Removed all traces of the "minikube" cluster.
and now specify the docker driver
PS C:\WINDOWS\system32> minikube start --driver=docker
* minikube v1.25.2 on Microsoft Windows 11 Home 10.0.22000 Build 22000
* Using the docker driver based on user configuration
* Starting control plane node minikube in cluster minikube
* Pulling base image ...
> gcr.io/k8s-minikube/kicbase: 379.06 MiB / 379.06 MiB 100.00% 10.23 MiB p
* Creating docker container (CPUs=2, Memory=3000MB) ...
* Preparing Kubernetes v1.23.3 on Docker 20.10.12 ...
- kubelet.housekeeping-interval=5m
- Generating certificates and keys ...
- Booting up control plane ...
- Configuring RBAC rules ...
* Verifying Kubernetes components...
- Using image gcr.io/k8s-minikube/storage-provisioner:v5
* Enabled addons: storage-provisioner, default-storageclass
* Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
I don't know kubernetes as I am learning it, but it appears to have worked. I hope this will be useful to someone so they do not have to go off and spend $99 to upgrade to Windows Pro - as I was going to do if this did not work
I am able to find my application logs using docker logs --follow containerId
But which is the physical location of these logs?
I used this link, But nothing is useful: Where is the Docker daemon log?
Thanks,
Harry
Those aren't the docker daemon logs. Those are normally stored in JSON files unless otherwise specified by the driver you select for logging.
They're normally stored in :
/var/lib/docker/containers/<container id>/<container id>-json.log
But you can verify with
docker inspect <container> | grep LogPath
Docker native command to find log location for any container docker inspect --format={{.LogPath}} <ContainerName>
ContainerId can also be used if needed to
I have installed docker on windows 10.
Docker version:
Docker version 17.09.0-ce, build afdb6d4
I tried to pull latest ubuntu and ubuntu:16.04 using the bellow two commands
docker pull ubuntu
docker pull ubuntu:16.04
But I am getting the below error.
docker pull ubuntu
Using default tag: latest
latest: Pulling from library/ubuntu
no matching manifest for windows/amd64 in the manifest list entries
So is there any way to fix this issue?
You can't run linux images with a windows daemon.
If you are running Docker for Windows, it gives you the ability to switch between running a Windows Docker daemon and a Linux Docker daemon inside a hyper-v VM.
To run Linux workloads, make sure you have chosen "Switch to Linux Containers" in the Docker for Windows whale icon menu.
please follow the Docker tutorial here
In this case the problem is it requires adding the --experimental flag when starting dockerd.exe.