diff --git a/Assets/Blog Posts/Docker/virtual_box_shared_folder.jpg b/Assets/Blog Posts/Docker/virtual_box_shared_folder.jpg new file mode 100644 index 0000000..ec4a1a9 Binary files /dev/null and b/Assets/Blog Posts/Docker/virtual_box_shared_folder.jpg differ diff --git a/README.md b/README.md index 2c118e7..3c58242 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ This is the repository for my personal website. This includes all linked files a - [ ] Quality of Life - [ ] Interviews / Networking - [ ] Undergrad / Grad Applications + - [x] Docker Tutorial - [x] Documentation - [x] Page Restructure - [x] Add Styling w/ CSS diff --git a/Web Pages/Common/navbar.html b/Web Pages/Common/navbar.html index 2938cc9..b6f2099 100644 --- a/Web Pages/Common/navbar.html +++ b/Web Pages/Common/navbar.html @@ -76,6 +76,13 @@ + +
A brief introduction to docker, how to use it, and what you can do with it.
++ Updated on March 17, 2020 +
+ + ++ Throughout my college career in computer science, I have found the need to develop applications that will be deployed in a Linux environment. As a windows user, I have usually turned to a couple of different options: virtual machines, Windows Subsystem for Linux, or Cygwin. Recently, I discovered an alternative method for building and testing Linux apps that is especially useful for collaboration and deployment. Docker allows you to package an OS and all the necessary dependencies into a docker image. You can then spin up an instance of this image called a docker container in which you can run your source code. The video below was incredibly helpful in my understanding of what docker is, how it's different from virtual machines, and how to use it. +
+ + + ++ Depending on your host machine's operating system, you will install one of the following Docker products. If you have macOS or Windows, your first option should be Docker Desktop. Check if you meet the system requirements. If you do not, Docker Toolbox is the legacy option that uses Oracle VirtualBox rather than Hyper-V or HyperKit for virtualization. I am using a computer with Windows 10 Home, so I use Docker Toolbox for Windows. This blog post will discuss some solutions to edge-case issues with Docker Toolbox that Docker Desktop users will hopefully not have to deal with. +
+choco install docker-desktop
choco install docker-toolbox
+ As mentioned previously, I am using Docker Toolbox since Windows 10 Home does not support Hyper-V for virtualization with Docker Desktop. You can run docker toolbox in a command prompt or powershell terminal, but I personally prefer to use WSL because I am more familiar with bash terminal commands. If you are interested in this setup, continue reading this section. Otherwise, you can skip ahead. +
+ ++ The default way to install WSL is through the Microsoft Store. This will install WSL on your system drive (e.g. C:\). If you are like me and don't want to install it on your system drive, follow the instructions here. +
+ +
+ After installing WSL, follow the instructions in Setting Up Docker Toolbox for Windows Home 10 and WSL to Work Perfectly! starting with Install Docker and Docker Compose within WSL. As you will have seen near the end of that post, there are some extra steps needed to ensure that volume mounts work. After setting root = /
, you will need to configure shared folders for the default
docker machine in VirtualBox.
+
+ I configured all of my drives as shared folders so I can mount any folders on my host machine to any docker containers I run. In your WSL terminal, run docker-machine.exe start
to start the default
docker machine created by the Docker Quickstart Terminal. After your docker machine is running, open the shared folder settings as shown in Fixing Volumes in Docker Toolbox. The image below shows how C:\
on my host computer is mounted at /
in folder c
on my docker machine such that C:\
maps to /c
. Make sure you have enabled Auto-mount
and Make Permanent
. Click OK to save all settings, then go back to the WSL terminal and run docker-machine.exe restart default
. Now your docker machine should be properly configured to allow volume mounting.
+
+ One issue I ran into with the default settings for the default
docker machine is the amount of RAM allocated to it. I attempted to build the GTSAM library inside a docker container and ran into an internal compiler error: Killed (program cc1plus). As mentioned here, the solution is to increase the RAM allocated to the docker machine in VirtualBox. In the WSL terminal, run docker-machine.exe stop
to shutdown the docker machine. When this is complete, right click on the default
docker machine in VirtualBox and open Settings. In the System tab, increase Base Memory. Similar to virtual machines, I would not recommend allocating more than half of your system's RAM. For example, my computer has 16 GB of RAM, so I would only recommend allocating up to 8 GB of RAM to the docker machine. You can look through the other options, such as number of allocated processor cores, as well if you wish.
+
+ To learn about Dockerfiles and a basic example, check out the video in the introduction. To learn about Docker Compose, check out the video below. +
+ + +