Installing Docker on Ubuntu Bash for Windows
Following on from his last blog, Anandraj Jagadeesan from our Sydney office, provides steps to install Docker on Ubuntu Bash for Windows.
Docker’s ability to provide applications with resource isolation, portability, consistency and support continuous integration & testing makes it a very attractive tool for every software engineer. With Docker, one can run the entire application stack in a local development machine and deploy to production quickly without worrying how it will perform in the new environment. Though Docker started as Linux container technology, understanding the power of the platform, Microsoft quickly embraced the technology to run Docker natively on Windows OS. This blog is about my experiences of “How to install Docker for Windows?” and integrating the same to “Bash on Ubuntu on Windows”.
Before installation, you should ensure that the below requirements are satisfied:
- Hyper-V is installed
- Virtualization is enabled
- Verify your Windows 10 version
Docker for Windows requires a Hyper-V as well as the Hyper-V Module for Windows Powershell to be installed and enabled. The Docker for Windows installer will enable it for you or to be sure you can install Hyper-V manually by going to ‘Programs and Features’ -> Turn Windows Features on or off -> Hyper-V and click OK. A reboot is required. If Hyper-V is installed manually without the reboot, Docker for Windows will not work correctly.
On some systems, Virtualization needs to be enabled in the BIOS. I had some challenges enabling the Virtualization in BIOS as I couldn’t access the BIOS during normal start-up because I had a UEFI-based computer. I had to enable “Advanced Restart” and to be able to make changes to the BIOS.
The steps for this are vendor specific depending on your hardware, but typically the BIOS option is called Virtualization Technology (VTx) or something similar. You can find some help here.
Confirm Virtualization is enabled in the Task Manager.
Windows 10 Version:
The current version of Docker for Windows runs on 64bit Windows 10 Pro, Enterprise and Education (1511 November update, Build 10586 or later) editions. In the future more versions of Windows 10 are expected to come under support.
When the pre-requisites are satisfied, download Docker for Windows from here , double click the “InstallDocker.msi” to run the installer and follow the prompts to run the installation. Docker starts automatically once the installation is complete.
On successful installation of Docker on Windows, it provides Docker Engine, Docker CLI client, Docker Compose, Docker Machine, and Kitematic.
Ubuntu Bash for Windows:
Install Docker for Ubuntu Bash following the steps below, which is similar to installing Docker on Ubuntu.
# Install packages to allow apt to use a repository over HTTPS
$ sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
# Add Docker's official GPG key
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# Set up the repository
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
# Update source lists
sudo apt-get update
# Install Docker
sudo apt-get install docker-ce
Now that the Docker engine is installed on both Windows and the WSL, ensure Docker is running on Windows.
In order to access the Docker from WSL, issue the following commands from bash:
$ echo "export DOCKER_HOST='tcp://0.0.0.0:2375'" >> ~/.bashrc
$ source ~/.bashrc
In the latest version of Docker (Version 17.06.0-ce-win19 (12801)), TCP endpoint is turned off by default. To activate it, right-click the Docker icon in your taskbar and choose Settings, and tick the box next to
“Expose daemon on tcp://localhost:2375 without TLS” (make sure you understand the risks).
Below shows the testing of the installation and running the hello-world container.
We’d love to hear from you
Submit the form below to start the process of maximising your business performance with confidence.