Reputation: 739
I am new to this Containerization and I was wondering how Docker could replace Virtual machines?
I am given a case study in which there are 2 virtual machines each acting as a virtual server, one is a Development server and the other is a Test Server and I am asked to study how Docker could help in managing the workflow efficiently.
In this case the 2 virtual Machines are Servers and the idea of Docker replacing virtual machines is confusing me.
can anyone help me understand this concept.
Thanks in Advance!!
Upvotes: 0
Views: 499
Reputation: 92
I am not sure how a server can be completely replaced by a docker container, so I am assuming you want to replace an 2 applications running in 2 servers into 1 server running 2 containers of each test and dev apps.
I am going to make a few assumptions before I can answer.
Docker Basics
Docker Registry - The place from where you can download base images So here it goes,
Setup docker on a unix server.
A sample dockerfile would look like something below
FROM webspher-liberty17:webProfile7
ENV SERVER_NAME=myapptestserver
RUN ["/bin/bash", "-c", "/opt/ibm/wlp/bin/server create $SERVER_NAME"]
EXPOSE 9080 9443
COPY server.xml jvm.options /opt/ibm/wlp/usr/servers/$SERVER_NAME/
COPY *.war /opt/ibm/wlp/usr/servers/$SERVER_NAME/dropins/
CMD ["/opt/ibm/docker/docker-server", "run", "myapptestserver"]
Now when you do a docker build of this docker file, it would create an image with base layer as ibm liberty. Every command after the FROM allows you to add an additional layer, so you can customize to your specifics.
Once you have done the above for both your apps, you practically have two variants of your app running on same server but serving two different environments.
Best part, add this to your CI/CD pipeline in bamboo/jenkins, and you can bring up and down environments in a jiffy.
Upvotes: 2
Reputation: 6519
Each docker container is itself act as a virtual machine means each container having its own os isolates the process from host.
So if you launch 2 containers means you will be running 2 ubuntu(for ex) servers.In each containers you can run your software and expose the service to outside world.
If eventually docker dies you can relaunch from image without installing OS,application unlike the virtual machines.
You can transfer the docker images to other server just like the import / export of your application , only requirement is to other server has docker service running.
If there are 2 dependent service which is running as container we can link those container for internal communication.Like wordpress as one container and mysql as other where both should have coneected, it that case docker link will help to interconnect.
You can manage the cpu,memory , disk for docker containers just like virtual machine in any of hypervisors.
for detailed info : https://docs.docker.com/engine/docker-overview/#docker-engine
Upvotes: 0