Docker on Windows tips & tricks

Just some tips & tricks on Docker on Windows I documented for myself.

Location of Docker daemon logs

The Docker daemon logs can be found in the following location.


By default C:\ProgramData is hidden in Explorer, you need to make it visible in the options (File -> Change folder and search options, select tab View, select the option ‘Show hidden files, folders and drives’ under ‘Hidden files and folders’).

Change folder and search options


Docker commands tips & tricks

Just some Docker commands tips & tricks I documented for myself.


Start interactive shell in Alpine image

Alpine uses the ash shell instead of the bash shell. This by the way also overrules the default CMD in the image.

$ docker run -it --entrypoint=/bin/ash image-id

Connect to a running container

What if you started a shell in the background and you want to see the stdout and stderr output? Connect to the running container.

$ docker attach container-id

Connect to a running container with an interactive shell

So what if you want to connect to a running container and inspect its contents? Just attach and start an interactive shell 🙂

$ docker exec -it container-id /bin/ash

Inspect image, volume or running container

It can be handy to inspect the settings of images, volumes or running containers. To do this use the following commands.

docker image inspect image-id
docker volume inspect volume-id
docker container inspect container-id


Traditionally, the Dockerfile is called Dockerfile and located in the root of the context directory. You use the -f flag with docker build to point to a Dockerfile anywhere in your file system.

IMPORTANT when pointing to a Dockerfile not located in the context directory, you must add a period (.) at the end of the statement.

$ docker build -t my-label -f /path/to/a/Dockerfile .


Volumes make it possible to persist data between container restarts and share data between containers.

Create a volume.

$ docker volume create logs

List files in a volume.

$ docker run -it --rm -v logs:/logs alpine ls -l /logs

Display the contents of a file in a volume.

$ docker run -it --rm -v logs:/logs alpine cat /logs/access.log

Interactive access to the files in a volume.

$ docker container run -ti -v logs:/logs alpine sh -c 'cd /logs; exec "${SHELL:-sh}'

Using tail with -f option to view changes to the contents of a file in realtime.

$ docker run -it --rm -v logs:/logs alpine tail -f -n 25 /logs/access.log

WTF!?! Docker asks for Azure AD credentials when sharing C drive

On my Docker quest I was surprised once again. I wanted to share my drive with my Docker container. I was presented with a login dialog that asked for my Azure AD credentials. Azure AD credentials? Seriously? Do I have Azure AD credentials?

UPDATE 9 November 2018

It turns out you do not have to use an Azure AD account for Shared Drives at all. You can just create a local account (i.e. DockerHost) using the instructions below points 2 to 4 .

The confusing part is that the dialog displayed the username as AzureAD\MyName. This didn’t ring a bell. After fiddling around I figured out that I could use my Office 365 credentials, but the username needed to be changed to my email address in the following format AzureAD\[email protected]. Go figure.

After logging in nothing happened and the share was unchecked again. WTF?!?!

After googling around I found the following post Sharing your C drive with Docker for Windows when using Azure Active Directory by Tom Chantler, which gave me enough information to fix the problem.

I had to make to three changes to the solution he describes in his post:

  1. I do not have Azure AD credentials. So I used my Office 365 credentials, which also uses Azure AD. So instead of the username being AzureAD\MyName, I had to change it to AzureAD\[email protected].
  2. I’m running Windows 10 Professional. It initially would not let me create a local users who’s username was not an email address. In the first dialog I needed to select ‘I don’t have this person’s sign-in information’ and in the next step ‘Add user without Microsoft account’. Then I could create the user with the same username (MyName) without the Azure\ prefix.
  3. Change the account type to Administrator.
  4. Go to the Docker Settings and select Shared Drives and use the local user account created in the previous step to authenticate. It should work now.


After that the C drive was shared. Whooha!

Docker: incorrect username or password

I’m reacquainting myself with Docker. My first steps were dodgy. I immediately ran into problems testing if Docker was installed correctly on my Windows 10 machine, when I wanted to execute the hello-world image.

docker run hello-world

Which threw the following error.

Unable to find image 'hello-world:latest' locally
docker: Error response from daemon: Get unauthorized: incorrect username or password.
See 'docker run --help'.

It turned out the problem was that I was a little to eager when I signed into the Docker Hub in the Docker Settings.


After logging out with the following command it worked.

docker logout

Go figure…