Basic Use of Docker
Docker is an open source application container that allows developers to package their applications and dependencies into a portable engine, and then publish them to operating system such as Linux or Windows for virtualization.
This blog covers basic introduction of the Docker environment, Dockerfile settings and construction of a multi-container environment using docker-compose (one of the essential tools to build, connect and run multiple containers).
(1) Docker containers
The following commands are used to install docker on virtual machine:
1 |
|
Then create a file name “Dockerfile ” and add the following contents in the file:
1 |
|
Contextualize a container (create a new image that is contextualized according to the Dockerfile and start a container based on the contextualized image):
1 |
|
Now we have a running docker container with some extra packages installed in it.
(2) DockerHub
DockerHub is used to store the Docker images, and developers also can use the images that are stored on DockerHub so the required development-environment can be built quickly. To use DockerHub, we need to create an account on its official website firstly. And the following commands are use to operate DockerHub on virtual machine.
1 |
|
All articles in this blog adopt the CC BY-SA 4.0 agreement except for special statements. Please indicate the source for reprinting!