Thought I'd post a note on Docker for Windows setup. Based off our experiences, we've been through the initial alpha - beta to stable versions of Docker for Windows and we've notes various pain points during this time. The idea of this gist is to be able to run through the steps to ensure your Docker on Windows is setup correctly
- If you have any older versions of Docker for Windows (includes Windows Docker Toolbox), you'll want to upgrade
- There are a number of reasons and main one if file mounting that is more stable in latest version of Windows Docker.
- Install : https://docs.docker.com/docker-for-windows/install/
- The version of Docker will require Hyper-V enabled in BIOS and Windows Features.
- After install, create a local admin user on your machine. Make sure its part of the local Administrators group
- Give this local administrator full control over your users directory. I.E C:\Users\JohnSmith
- Open Docker for Windows and use the "Reset Credentials" button to set the Docker machine Credentials to this new user.
- Add this variable to your Environment variables or run it each time you open a terminal:
export MSYS_NO_PATHCONV=1
- This will help you run more efficient in bash terminals as your terminal will be able to understand Linux pathing which is important!
- You should try stick to a UNIX terminal, like Git Bash.
- This helps keep things uniform and standard for running cross platform (shell scripts etc..)
- Once you done all the above, make sure your shell is restarted - Many settings only load upon start up :)
- When you see the following types of errors whilst doing docker pull, run or builds:
Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on [::1]:53: read udp [::1]:50181->[::1]:53: read: connection refused
Open up Docker for windows | settings | reset && restart docker. This works for me 99% of the time
You should be able to run a docker container with full volume mount. You can test by running my Kubernetes tools set image. This image contains all tools you need to do stuff:
- Azure CLI
az
- Helm
helm
- Kubernetes CLI
kubectl
You can run it :
docker run -it --name kube-tools -v $PWD:/var/lib/src -v /C/Users/docker/kube-tools/.kube:/root/.kube -v /C/Users/docker/kube-tools/.azure:/root/.azure --rm -p 8001:8001 --workdir /var/lib/src aimvector/kube-tools:latest
Once you are in, try:
az --help
kubectl --help
helm --help
More info: https://github.com/marcel-dempers/kube-tools
Troubleshooting: To open Docker for Windows, click the "Up Arrow" on the taskbar in the Notifications area and then click the Docker whale icon. If it shows the error, Quit Docker, then start Docker for Windows again.