Microservice architecture, or simply microservices, is a distinctive method of developing software systems that tries to focus on building single-function modules with well-defined interfaces and operations. The trend has grown popular in recent years as Enterprises look to become more Agile and move towards a DevOps and continuous testing. Microservices can help create scalable, testable software that can be delivered weekly, not yearly.
Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and ship it all out as one package. By doing so, thanks to the container, the developer can rest assured that the application will run on any other Linux machine regardless of any customized settings that machine might have that could differ from the machine used for writing and testing the code.
A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another. A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings.
Please Clone your server
git clone git@github.com:CBNCloud/sample-microservice-docker-container.git
The docker build command builds Docker images from a Dockerfile and a “context”. A build’s context is the set of files located in the specified PATH or URL. The build process can refer to any of the files in the context. For example, your build can use a COPY instruction to reference a file in the context.so this sample microservices have 2 service :
cd logins
docker build -t logins .
in docker images you can see logins in images docker
cd users
docker build -t users .
in docker images you can see Users in images docker
in docker you can start container, example :
docker run -d <images docker>
noted: by default follow the installation port in the docker image
same with Docker, but you can change docker port, example :
docker run -p <inggress>:<enggres> -d <images docker>
you can push images docker hub :
Docker tag <images id > <dockerid>/<name images>:<tag>
noted:
images id : you can see docker ( docker images )
dockerid : login dockerid
name images : you can see docker ( docker images )
tag : you must fill the tag, but you don't fill the name is latest