In this article I address some most common problems when working with Docker on Windows 10. Today we want to get up running Jekyll in Docker. The most common problems you encounter occur in file system path translations when using Docker commands. And the second problem you may not think about is the choice of command line. Do you use cmd.exe, PowerShell or a Linux command line like MSYS or Cygwin within Windows? You must take care of the path variables when using a command line.
Table of content
- Prerequisite: activate ‘Shared Drive’ in Docker settings
- Run a Jekyll container
- Resources for further reading
Prerequisite activate ‘Shared Drive’ in Docker settings
Activate ‘shared drive’ to let Docker containers access your hard drive. A tcp port 445 in your Windows Host firewall will be opened for communication between your Windows host (IP: 10.0.75.1) and the Docker vm (IP: 10.0.75.2).
From time to time it is necessary to renew the credentials for a shared drive in Docker. Especially when you get the Docker error like your host path is not accessible or other bind mount errors. To do so, simply deactivate and activate the shared drive setting.
To test if you can get access to your mounted drive, you can start an Alpine Linux bash and navigate to your mounted SMB drive
C:\ like this:
To start alpine Linux and bind Windows drive
C:\ to alpine Linux
/path/ path, type in
$ docker run --rm -it -v C::/data alpine sh
A bash on Alpine Linux starts. You can now list the content of the mounted
/data/ path in your Alpine Linux container. It should contain your drive
C:\ on your Windows host.
$ ls /data/
Run a Jekyll container
Navigate to your Jekyll project. Open
cmd.exe. From here we use
%C% to tell Docker that we want to bind the current project directory to the Jekyll container path:
$ docker run -v %CD%:/usr/src/app -p "4000:4000" starefossen/github-pages