Installing Docker on your computer running Windows 10 Pro is possibly the best way to learn Docker. There are literally thousands of Docker images which include software like WordPress, Joomla, Magento which you can pull and run from Docker Hub and view in your browser. By mastering just few commands anyone is now able to install all the necessary software that is needed to run many of the worlds most popular software and thus create the ideal environment to learn and the perfect environment for any developer. If you actually looking to install Docker on a CentOS server we have an tutorial for you.
Docker runs best on a 64bit version of Windows 10 Pro, reason being is because Docker requires HyperV to be installed and this feature is a default feature of Windows 10 Pro. It just needs to be enabled on your machine.
First you will need to download Docker CE Desktop for Windows which you can do by visiting this link https://hub.docker.com/editions/community/docker-ce-desktop-windows. Unless you are an experienced developer and you prepared to weather instability and bugs, I recommend that you install the stable version and not the Edge version. Apart from the file being approx 550MB, download and installation is quite straight forward, pretty much the same as any other software that you would install on Windows but there are a few settings which you need to know about and these don’t seem to be too well documented. So before you actually install Docker, I’m going to show you the settings you need to enable and set on your computer before and after installation.
From Windows Start, click on “Settings” and in the Search Bar at the top, Search for Windows Features and select the “Turn Windows Features on or off”.
You then need to check the checkbox next to HyperV and a little further down, check the “Windows Subsystem for Linux” and enable PowerShell.
Once you have completed this step, Windows will update your machine with the necessary files. It may prompt you to reboot, if not, reboot anyway. You will then be ready to go ahead and install Docker just like any other software you would normally install.
During the installation of Docker, Docker creates an additional user group in Windows called “Docker-users”. You will need to add your username to that Group. To do this, right-click on the Windows Start and select “Computer Management. Then select ” Local Users and Groups” and select “Groups”. You’ll see the docker-users group. Double click or right-click and select “Properties”, and add your username to the group. After you have completed these steps. Restart Docker.
After Docker has restarted, you are now ready to start using Docker. Open PowerShell and at the command prompt type the following to verify that Docker is working
and that should output something like this
Right click on the little whale in your task bar to invoke the menu and click on settings. You can pretty much leave the settings as they are but you may want to change the following.
Shared Drives Tab Docker is able to detect all hard drives. You will need to at least select one hard drive.
Advanced Tab Here you can set the computer resources – CPU, memory and disk space – that you’ll allow Docker to utilize.
Now that Docker is installed and setup on your computer, you’ll want to start using Docker. I’ve put together a simple effective and working tutorial using Docker Compose which will enable you install WordPress on your computer.
Creating your first Project using Docker Compose
Dockerfiles are used to create images and these images can be pulled from Docker Hub using Docker. Now in order for a WordPress web site to run, it needs a web server, the database in which to store the data and obviously WordPress. Docker Compose is used when you want to combine a few images together and for this tutorial, we will use Docker Compose to pull mySQL 5.7, phpMyAdmin to make it easier for you to manage the database and the latest version of WordPress from Docker Hub.
You will need to have a good IDE and there are many free excellent IDE’s around that you can install. Notepad ++ and Sublime Text are good light weight editors which can be downloaded. Eclipse and Visual Studio, Netbeans rank amongst the top IDE’s around.
First create a folder on your
C:\ drive, and for the sake of this tutorial, name it “myprojects” so the path should be
Copy and paste the file below and save it as “docker-compose.yml” in your “myprojects” folder. Once you have your project up and running we’ll have a closer look at the file and what it does and we’ll go over some basic Docker commands that you should know about.
Start PowerShell and at the command prompt you will need to navigate to the myprojects folder on your C Drive.
When you in your
c:\myprojects folder then run the following command
note that this command is what I recommend you run when you first setting up a project – I never run a command with the
-d in detached mode because I like to see the details of the installation – often they include comments which could be helpful and it could notify you of errors.
Now type “localhost” in your browser – you should see the familiar WordPress Install page.
and if you type “localhost:8080” in your browser you will get to phpMyAdmin.
Now too would be a good time to browse to your “myprojects” folder on your C:\ drive – you’ll see that a new folder has been created and there you will find all your WordPress files.
But before you dive in and install your WordPress, lets have a look at what Docker Compose file did and explore some of the commands that you should be aware of.
I hope you’ve learnt a little something from this tutorial if there is anything we can help with, please feel reach out to us, we’ll be more than happy to assist. There is no shortage of information about Docker on the web so get out there, start learning and have a whale of time!