Share Everything to Everyone

Minggu, 07 November 2021

A Little Note For Using Docker Container

19.20 Posted by ROSYID'S BLOG , No comments
What is Container? maybe some of you are still confused about what is Container and what is different between Container and Virtual Machine.

In general, Container is a set of operating systems that included the environment for running applications like Runtime, Service App, Database, etc. Actually, we don't need to install OS, Database, and Server Applications anymore. We call it the Container in Docker.

Docker is a standard platform to create and manage this Container. 

Just keep in mind that simple knowledge, let us make some containers in docker from the images registry.

Type docker images to show the list of images in local


We need to pull an image from the repository. Type docker pull mongo:4.1 to download the image.


Check local images using docker images in the terminal. we can see the additional image appear in those lists.


After this, we need to make a container in the local, and we must expose the port to enable users to access this container.
Type docker container create --name mongoserver1 -p 8080:27017 mongo:4.1 . We expose internal port container 27017 to be external port 8080. All users accessing port 8080 to use app service in the container.


We check first that container has been created. Type docker container ls --all


Let's start the container, type docker container start mongoserver1 to running.


Then, we make sure that container already running at properly port number. 
Type docker container ls only.


Last but not least, we must try to accessing this mongoserver from client.








0 komentar:

Posting Komentar