This article is for beginners of Docker to learn the basic contents.
Docker is one type of virtualization and is called container-type virtualization. Container-type virtualization allows you to deploy a virtual OS on the OS by creating a virtual space called a "container" on the OS, and further divide (isolate) the process execution space.
--Fast startup speed --Moveable --Light operation --Resources can be used effectively
The main reason is that you can move and make effective use of resources. Since the efficiency of the server can be improved by actively replacing unused computer resources, it is compatible with cloud services and other variable costs. Google puts all the software in a container and uses it while actively replacing it to improve the efficiency of the server.
In the past, when creating any service, engineers were severely constrained by the environment. I had to develop while worrying that the code I wrote would really work on the server. However, by using Docker, by developing while running the container on docker such as your own PC, you can finish the code and finally move the container to make the application work. For this reason, Docker is not limited to the skills of infrastructure engineers. → It is said to be a required subject for programmers.
1 Docker installation -Install Docker on the OS. Can be installed on mac, Windows and Linux. 2 Creating a Dockerfile -Dockerfile is a text file that determines the procedure for creating a completely new Docker Image. Therefore, it is not necessary if you do not create a completely new Docker Image, such as when fetching from the Internet. 3 Creating a Docker Image -Create a container image by bringing it from any location. In the initial stage after installing Docker, the container image does not exist, so bring it from the Internet by command input. -There is a place called "Docker Hub" as a general image storage location on the Internet. In addition, AWS ECR is built, stored and managed on a repository server unique to various companies. 4 Container startup
・ Get an image from the internet
$ docker pull [Image name]
You can also find commands that you can copy and paste by creating an account in Docker Hub and searching for the service name. Copy and paste to pull this image.
Example) Apache image acquisition
$ docker pull httpd
・ Check if the image was taken
$ docker images
・ Start docker → About options ① -d Run docker in the background ② Specify the -p port. [8088: 80] is the relationship of [Host port: Container port]. It means that port 80 of the container is listened to at 8088 on the host side.
$ docker run -d -p 8088:80 httpd
・ See the status of the container → You can see the items of container ID and STUTAS.
$ docker ps -a
・ Container stop
$ docker stop [Container ID]
-Delete the container itself
$ docker rm [Container ID]
-Delete image
$ docker rmi [Container ID]
This time, I summarized the basic knowledge of Docker. Applications include creating Dockerfiles, managing multiple containers using docker-composer, and managing resources for multiple Dockers using orchestration tools.
Recommended Posts