Docker is a platform software that enables you to make, test, develop, and distribute apps fast. Using Docker, you can easily develop and deploy an app to any environment and make sure your code works. This is a convenience feature of docker for us, developers. Docker containerizes software in a container which has any dependencies needed for our apps to work such as library, system kernel, code.
You can maintain and scale easily if you run Docker in your daily operation. There two Docker licenses you can use, Docker Community Edition (CE), it is an open source license, and Docker Enterprise Edition (EE) is a subscription base.
Docker was an internal project built by Solomon Hykes when he was in dotCloud. In May 2013, Docker was released to open source community. Docker has massive growth in community that make it better and better tool until now.
This tutorial will cover basic fundamental why you have to use docker to contain your apps environment.
How Docker Works
Docker run your code in a standard way, wrap it in a complete file-system along system tools, library, regardless of the environment, in essence, code sandbox. Similar with virtual machine virtualizes hardware, Docker virtualizes operating system in a container. Docker will be installed in every server to easily manage and give simple command to start, stop, and restart a container.
There are some terms you should know and these terms usually mostly use in Docker world, such as:
- Dockerfile: It is simple text file that contains docker configuration on how to build your images. Dockerfile usually in a root of your context folder that runs with
docker-composecommand. It is like a recipe.
- Image: A snapshot file that may contains operating system, data files, or applications.
- Container: It is a sandbox of your Docker environment. Or it is a baked cake.
Install Docker and Docker Compose
Before we start using Docker, we will install Docker first.
To install Docker we need to download and install the files to our PC.
- Docker for Mac: https://docs.docker.com/docker-for-mac/install/
- Docker for Windows: https://docs.docker.com/docker-for-windows/install/
- Docker for Linux: https://www.docker.com/community-edition
Also you need Docker Compose to run multi containers with Docker.
To install Docker Compose: https://docs.docker.com/compose/
Now, you have installed Docker and Docker Compose, you can check the version that installed in your PC with this command.
$ docker --version$ docker-compose --version
Run Our First Docker Image
You can now run your first Docker app, check and confirm whether Docker correctly installed with this command:
$ docker run hello-world
Well done. You now complete the basic knowledge using Docker. You can try to build your own Docker Image.
Originally posted 2019-03-19 23:00:00.