Feb 07 2020

How to Get Started with Docker Containers

Containerization is sweeping the world of DevOps, but admins still know little about it. Here’s how to start using the original container tech, Docker.

Many system administrators have heard about Docker but don’t know much about it. While Docker and DevOps often get discussed together, they are not the same. You can begin using Docker today even if you are not part of a DevOps team. Let’s discover how to get started using Docker Desktop on Windows.

1. Know the Requirements for Docker

Getting started with Docker requires a computer running 64-bit Windows 10 Pro, Windows 10 Enterprise or Windows 10 Education, as well as a processor capable of second level address translation. (Since about 2008, all Intel and AMD processors have been SLAT-capable.) At least 4 gigabytes of RAM are also necessary. Admins must enable hardware virtualization in their basic input/output systems. Check that virtualization is enabled by opening Task Manager, then choosing the Performance tab, then ensuring the Virtualization setting says “Enabled.”

 

2. How To Install Docker Desktop for Windows

The easiest method to install Docker is to go to docker.com, open the products menu and click on Docker Desktop. Follow the prompts to create an account and download the installer. Leave unchecked the box that asks whether to use Windows or Linux containers. Of course, it will be necessary to reboot to complete the installation. Docker will enable Microsoft Hyper-V if needed.

3. How To Run a Docker Container

To run or manage Docker containers, open a PowerShell console. Start a Nginx web server container in the background (--detach) on port 80 using the docker container run parameter: docker container run --detach -port 80:80 nginx. It will return a container ID that uniquely identifies the container. View the container status with the docker ps command. Execute a shell on the running container by replacing it with the ID that was returned: docker exec -it <CONTAINER ID> sh.

MORE FROM BIZTECH: Read how to successfully migrate to a collaboration tool.

4. Execute Commands in a Docker Container

After connecting to the container’s console, admins can execute commands as if they are on another computer. Create a file: echo "Hello World" > test.txt. View the file: cat test.txt. You also have all commands that would be available to you if you had manually installed Alpine Linux yourself. When done, type exit to leave the container. 

Ngampol Thongsai/Getty Images

More On